私はJavaにかなり慣れていないので、かなり簡単に習得できると思われる問題に直面しています。
ライブラリにリンクされたプロジェクトを生成していApache - Commons Math
ます。
プロジェクト内では、かなり多くのRealMatrix
オブジェクトを使用しています。私は次のように動作するメソッドを持っています
public static RealMatrix DistCalc(RealMatrix YCoord, RealMatrix ZCoord){
RealMatrix Distance = new Array2DRowRealMatrix(YCoord.getRowDimension(),ZCoord.getRowDimension());
for(int ii = 0; ii < YCoord.getRowDimension(); ii++){
for(int jj = 0; jj < ZCoord.getRowDimension(); jj++){
Distance.setEntry(ii,jj,Math.sqrt((YCoord.getEntry(ii, 0) - YCoord.getEntry(jj, 0))*(YCoord.getEntry(ii, 0) - YCoord.getEntry(jj, 0)) + (ZCoord.getEntry(jj, 0) - ZCoord.getEntry(ii, 0))*(ZCoord.getEntry(jj, 0) - ZCoord.getEntry(ii, 0))));
}
}
return Distance;
}
もう1つは特定のComplex
行列を生成し、
// Define the random phase for the u- component
public static Complex[][] RandPhi(int N, int nFFT){
Complex[][] nn_u = new Complex[N][nFFT];
for(int ii = 0; ii < N; ii++){
for(int jj = 0; jj < nFFT; jj++){
nn_u[ii][jj] = new Complex(Math.cos(new Random().nextDouble()*2*Math.PI),Math.sin(new Random().nextDouble()*2*Math.PI));
}
}
return nn_u;
}
ここで、行列nn_uを使用して列単位でRealMatrix
Distanceを乗算したいと思います。最終的に、行列を作成する必要があります。 Complex
Complex[N][nFFT]
光を当ててみませんか?