Ralph Vince - Portfolio Mathematics

(Brent) #1

392 THE HANDBOOK OF PORTFOLIO MATHEMATICS


for(int i=0;i<N;i++){
hprs[j][i]= 1.0 + f[j] (-plays[i][j] /
biggestLoss[j]);
}
}
//take the arithmetic average of the hprs
hpr = new double[N];
for(int i=0;i<N;i++){//go through each play
for(int j=0;j<msnames.length;j++){ //go through
each msnames
hpr[i] += hprs[j][i];
}
}
for(int i=0;i<N;i++){
hpr[i] /= (double)msnames.length;
}
}

protected String readInputFile(String fileName){
FileInputStream fis = null;
String str = null;
try {
fis = new FileInputStream(fileName);
int size = fis.available();
byte[] bytes = new byte [size];
fis.read(bytes);
str = new String(bytes);
} catch (IOException e) {
} finally {
try {
fis.close();
} catch (IOException e2) {
}
}
return str;
}

protected String[] getArgs(String parameter, String
delimiter){
String args[];
int nextItem=0;
StringTokenizer stoke=new
StringTokenizer(parameter,delimiter);
args=new String[stoke.countTokens()];
while(stoke.hasMoreTokens()){
args[nextItem]=stoke.nextToken();
Free download pdf