BlockRealMatrix extends AbstractRealMatrix implements Serializable { @Override public double getNorm() { final double[] colSums = new double[BLOCK_SIZE]; double maxColSum = 0; for (int jBlock = 0; jBlock < blockColumns; jBlock++) { final int jWidth = blockWidth(jBlock); Arrays.fill(colSums, 0, jWidth, 0.0); for (int iBlock = 0; iBlock < blockRows; ++iBlock) { final int iHeight = blockHeight(iBlock); final double[] block = blocks[iBlock * blockColumns + jBlock]; for (int j = 0; j < jWidth; ++j) { double sum = 0; for (int i = 0; i < iHeight; ++i) { sum += FastMath.abs(block[i * jWidth + j]); } colSums[j] += sum; } } for (int j = 0; j < jWidth; ++j) { maxColSum = FastMath.max(maxColSum, colSums[j]); } } return maxColSum; } BlockRealMatrix(final int rows, final int columns);  BlockRealMatrix(final double[][] rawData);  BlockRealMatrix(final int rows, final int columns,
                           final double[][] blockData, final boolean copyArray); static double[][] toBlocksLayout(final double[][] rawData); static double[][] createBlocksLayout(final int rows, final int columns); @Override BlockRealMatrix createMatrix(final int rowDimension,
                                        final int columnDimension); @Override BlockRealMatrix copy(); @Override BlockRealMatrix add(final RealMatrix m); BlockRealMatrix add(final BlockRealMatrix m); @Override BlockRealMatrix subtract(final RealMatrix m); BlockRealMatrix subtract(final BlockRealMatrix m); @Override BlockRealMatrix scalarAdd(final double d); @Override RealMatrix scalarMultiply(final double d); @Override BlockRealMatrix multiply(final RealMatrix m); BlockRealMatrix multiply(BlockRealMatrix m); @Override double[][] getData(); @Override double getNorm(); @Override double getFrobeniusNorm(); @Override BlockRealMatrix getSubMatrix(final int startRow, final int endRow,
                                        final int startColumn,
                                        final int endColumn); @Override void setSubMatrix(final double[][] subMatrix, final int row,
                             final int column); @Override BlockRealMatrix getRowMatrix(final int row); @Override void setRowMatrix(final int row, final RealMatrix matrix); void setRowMatrix(final int row, final BlockRealMatrix matrix); @Override BlockRealMatrix getColumnMatrix(final int column); @Override void setColumnMatrix(final int column, final RealMatrix matrix); @Override RealVector getRowVector(final int row); @Override void setRowVector(final int row, final RealVector vector); @Override RealVector getColumnVector(final int column); @Override void setColumnVector(final int column, final RealVector vector); @Override double[] getRow(final int row); @Override void setRow(final int row, final double[] array); @Override double[] getColumn(final int column); @Override void setColumn(final int column, final double[] array); @Override double getEntry(final int row, final int column); @Override void setEntry(final int row, final int column, final double value); @Override void addToEntry(final int row, final int column,
                           final double increment); @Override void multiplyEntry(final int row, final int column,
                              final double factor); @Override BlockRealMatrix transpose(); @Override int getRowDimension(); @Override int getColumnDimension(); @Override double[] operate(final double[] v); @Override double[] preMultiply(final double[] v); @Override double walkInRowOrder(final RealMatrixChangingVisitor visitor); @Override double walkInRowOrder(final RealMatrixPreservingVisitor visitor); @Override double walkInRowOrder(final RealMatrixChangingVisitor visitor,
                                 final int startRow, final int endRow,
                                 final int startColumn, final int endColumn); @Override double walkInRowOrder(final RealMatrixPreservingVisitor visitor,
                                 final int startRow, final int endRow,
                                 final int startColumn, final int endColumn); @Override double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor); @Override double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor); @Override double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor,
                                       final int startRow, final int endRow,
                                       final int startColumn,
                                       final int endColumn); @Override double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor,
                                       final int startRow, final int endRow,
                                       final int startColumn,
                                       final int endColumn); static final int BLOCK_SIZE; }
@Test public void testNorm() { BlockRealMatrix m = new BlockRealMatrix(testData); BlockRealMatrix m2 = new BlockRealMatrix(testData2); Assert.assertEquals("testData norm",14d,m.getNorm(),entryTolerance); Assert.assertEquals("testData2 norm",7d,m2.getNorm(),entryTolerance); }