### Question:
FloatMatrix { public FloatMatrix transpose() { FloatMatrix result = FloatMatrix.zeroes(numCols, numRows); for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { result.set(j, i, get(i, j)); } } return result; } FloatMatrix();  FloatMatrix(float[] data, int numRows, int numCols);  FloatMatrix(float[] data, int numRows, int numCols, boolean copy);  FloatMatrix(float[][] gridData); void assume(float[] data, int numRows, int numCols); static FloatMatrix zeroes(int numRows, int numCols); static FloatMatrix ones(int numRows, int numCols); static FloatMatrix eye(int size); static FloatMatrix columnVector(float[] data); static FloatMatrix columnVector(float[] data, boolean copy); static FloatMatrix rowVector(float[] data); static FloatMatrix rowVector(float[] data, boolean copy); FloatMatrix copy(); float[][] asGrid(); float[] asColumnArray(); float[] asRowArray(); float get(int row, int col); void set(int row, int col, float value); int size(); int numRows(); int numCols(); @Override boolean equals(Object otherObj); @Override String toString(); FloatMatrix elementSub(FloatMatrix other); FloatMatrix elementSub(FloatMatrix other, boolean inPlace); FloatMatrix elementAdd(FloatMatrix other); FloatMatrix elementAdd(FloatMatrix other, boolean inPlace); FloatMatrix elementMul(FloatMatrix other); FloatMatrix elementMul(FloatMatrix other, boolean inPlace); FloatMatrix elementDiv(FloatMatrix other); FloatMatrix elementDiv(FloatMatrix other, boolean inPlace); FloatMatrix elementLog(); FloatMatrix elementLog(boolean inPlace); FloatMatrix sub(float val); FloatMatrix sub(float val, boolean inPlace); FloatMatrix add(float val); FloatMatrix add(float val, boolean inPlace); FloatMatrix mul(float val); FloatMatrix mul(float val, boolean inPlace); FloatMatrix div(float val); FloatMatrix div(float val, boolean inPlace); float norm1(); float norm2(); FloatMatrix transpose(); FloatMatrix mul(FloatMatrix b); FloatMatrix mul(FloatMatrix b, boolean transposeA, boolean transposeB, float alpha); FloatMatrix mul(FloatMatrix b, FloatMatrix c, boolean transposeA, boolean transposeB, float alpha, float beta); float dot(FloatMatrix other); FloatMatrix inverse(); FloatMatrix choleskyDecomposition(); FloatMatrix choleskyDecomposition(boolean inPlace); int[] lapack_sgesv(FloatMatrix b); void lapack_spotrf(boolean upper); FloatMatrix blas_sgemm(
            FloatMatrix b, FloatMatrix c,
            boolean transposeA, boolean transposeB,
            float alpha, float beta); float blas_sdot(FloatMatrix y);  }### Answer:
@Test public void testTranspose() { FloatMatrix matrix; FloatMatrix transpose; FloatMatrix solution; matrix = FloatMatrix.eye(4); transpose = matrix.transpose(); assertEquals(FloatMatrix.eye(4), transpose); matrix = FloatMatrix.zeroes(3, 4); solution = FloatMatrix.zeroes(4, 3); float count = 0.0f; for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { matrix.set(i, j, count); solution.set(j, i, count); count += 1.0f; } } transpose = matrix.transpose(); assertEquals(solution, transpose); }