Matrices { public static Matrix transposedView(final Matrix m) { Preconditions.checkArgument(!(m instanceof SparseColumnMatrix)); if (m instanceof TransposedMatrixView) { return ((TransposedMatrixView) m).getDelegate(); } else { return new TransposedMatrixView(m); } }  static Matrix functionalMatrixView(final int rows,
                                                  final int columns,
                                                  final IntIntFunction gf,
                                                  final boolean denseLike); static Matrix functionalMatrixView(final int rows,
                                                  final int columns,
                                                  final IntIntFunction gf); static Matrix transposedView(final Matrix m); static Matrix gaussianView(final int rows,
                                          final int columns,
                                          long seed); static Matrix symmetricUniformView(final int rows,
                                                  final int columns,
                                                  int seed); static Matrix uniformView(final int rows,
                                         final int columns,
                                         int seed); static IntIntFunction gaussianGenerator(final long seed); static IntIntFunction uniformSymmetricGenerator(final int seed); static IntIntFunction uniformGenerator(final int seed);  }
@Test public void testViewDenseSparseReporting() { Matrix m = new SparseMatrix(1000, 1000); m.set(1, 1, 33.0); Matrix mt = Matrices.transposedView(m); assertTrue(mt.viewColumn(0).isDense() == m.viewRow(0).isDense()); assertTrue(mt.viewRow(0).isDense() == m.viewColumn(0).isDense()); m = new DenseMatrix(10,10); m.set(1, 1, 33.0); mt = Matrices.transposedView(m); assertTrue(mt.viewColumn(0).isDense()); assertTrue(mt.viewRow(0).isDense()); }