MatrixUtils { public static DoubleMatrix2D normalizeColumnL2(DoubleMatrix2D A, double[] work) { work = prepareWork(A, work); for (int r = 0; r < A.rows(); r++) { for (int c = 0; c < A.columns(); c++) { work[c] += A.getQuick(r, c) * A.getQuick(r, c); } } for (int c = 0; c < A.columns(); c++) { work[c] = Math.sqrt(work[c]); } normalizeColumns(A, work); return A; }  static DoubleMatrix2D normalizeColumnL2(DoubleMatrix2D A, double[] work); static DoubleMatrix2D normalizeSparseColumnL2(
      final DoubleMatrix2D A, final double[] work); static DoubleMatrix2D normalizeColumnL1(DoubleMatrix2D A, double[] work); static double computeOrthogonality(DoubleMatrix2D A); static double computeSparseness(DoubleMatrix2D A); static int[] minInColumns(DoubleMatrix2D A, int[] indices, double[] minValues); static int[] maxInColumns(DoubleMatrix2D A, int[] indices, double[] maxValues); static int[] maxInColumns(
      DoubleMatrix2D A, int[] indices, double[] maxValues, DoubleFunction transform); static int maxInRow(DoubleMatrix2D A, int row); static double[] sumRows(DoubleMatrix2D A, double[] sums); static double frobeniusNorm(DoubleMatrix2D matrix); static DoubleMatrix2D sortedRowsView(
      DoubleMatrix2D matrix, IndirectComparator comparator);  }
@Test public void testNormalizeColumnsL2() { DoubleMatrix2D unnormalisedColumns = nonZeroColumnMatrix(); MatrixUtils.normalizeColumnL2(unnormalisedColumns, null); checkL2Normalization(unnormalisedColumns); }
@Test public void testNormalizeColumnsL2Zeros() { DoubleMatrix2D unnormalisedColumns = zeroColumnMatrix(); MatrixUtils.normalizeColumnL2(unnormalisedColumns, null); checkL2Normalization(unnormalisedColumns); }