public static DMatrixRBlock transpose ( DMatrixRBlock A , DMatrixRBlock A_tran ) { if ( A_tran != null ) { if ( A . numRows != A_tran . numCols || A . numCols != A_tran . numRows ) throw new IllegalArgumentException ( "Incompatible dimensions." ) ; if ( A . blockLength != A_tran . blockLength ) throw new IllegalArgumentException ( "Incompatible block size." ) ; } else { A_tran = new DMatrixRBlock ( A . numCols , A . numRows , A . blockLength ) ; } for ( int i = 0 ; i < A . numRows ; i += A . blockLength ) { int blockHeight = Math . min ( A . blockLength , A . numRows - i ) ; for ( int j = 0 ; j < A . numCols ; j += A . blockLength ) { int blockWidth = Math . min ( A . blockLength , A . numCols - j ) ; int indexA = i * A . numCols + blockHeight * j ; int indexC = j * A_tran . numCols + blockWidth * i ; transposeBlock ( A , A_tran , indexA , indexC , blockWidth , blockHeight ) ; } } return A_tran ; }
Transposes a block matrix .