/** * Returns the transpose of the input matrix, i.e. where every element (i,j) * in the output has the value of the element at (j,i) in the input. */ public static Matrix transpose(Matrix matrix) { // Create a transposed view of the data. If the data was already // transposed, return the original matrix return (matrix instanceof TransposedMatrix) ? ((TransposedMatrix)matrix).m : new TransposedMatrix(matrix); } }
/** * Returns the transpose of the input matrix, i.e. where every element (i,j) * in the output has the value of the element at (j,i) in the input. */ public static Matrix transpose(Matrix matrix) { // Create a transposed view of the data. If the data was already // transposed, return the original matrix return (matrix instanceof TransposedMatrix) ? ((TransposedMatrix)matrix).m : new TransposedMatrix(matrix); } }