231f6e8d1cc9b4f26e67d7e09138e204ba77ec07
[IRC.git] / Robust / src / Benchmarks / Prefetch / 2DFFT / dsm / Matrix.java
1 public class Matrix {
2   public int M, N; //M = height, N = width
3   public double[][] dataRe;
4   public double[][] dataIm;
5
6   public Matrix(int M, int N) {
7     this.M = M;
8     this.N = N;
9     dataRe = global new double[M][N];
10     dataIm = global new double[M][N];
11   }
12
13   public void setValues(double[] inputRe, double[] inputIm) {
14     for (int i = 0; i<M; i++) {
15       double dataRei[] = dataRe[i];
16       double dataImi[] = dataIm[i];
17       for(int j = 0; j<N; j++) {
18         dataRei[j] = inputRe[i * N +j];
19         dataImi[j] = inputIm[i * N +j];
20       }
21     }
22   }
23
24   //Transpose matrix input.
25   private float[][] transpose(float[][] input) {
26     float[][] output = new float[N][M];
27
28     for (int j = 0; j < N; j++)
29       for (int i = 0; i < M; i++)
30         output[j][i] = input[i][j];
31
32     return output;
33   } // End of function transpose().
34 }