I update the values of a multi-dimensional array (Y[i][t][k]). Since the update needs to be done over many iterations, the runtime of this part of the code is really important. I was wondering if anyone knows how to do this in a more efficient way.
Below is the part that needs to be updated.
double [][][] Y=new double [a.length][b.length][c.length];
for(int i=0;i<a.length;i++){
for(int j=0;j<b;j++){
for (int k=0; k<c.length; k++){
if(i==w && j==r && k==u){// w, r and u can have any value.
Y[i][j][k]=g;
}else{
Y[i][j][k]=f;
}
}
}
}
Note that:
a is int [][].
b is int.
c is int [][].
q is double.
YIN is double [][][].
F is double.
g=q*YIN[i][j][k]+(1-q)*(Y[i][j][k]-F)
f=q*YIN[i][j][k]+(1-q)*(Y[j][j][k])