/** * 转置矩阵,转置矩阵的行数等于原矩阵的列数,列数等于原矩阵的行数 c[i][j] = a[j][i] * * @return */ public Matrix transposeMatrix() { int cRow = this.matrixData[0].length; int cColumn = this.matrixData.length; double[][] cData = new double[cRow][cColumn]; for (int i = 0; i < cRow; i++) { for (int j = 0; j < cColumn; j++) { cData[i][j] = this.matrixData[j][i]; } } return new Matrix(cData); }