@Test public void testBasics() { Matrix a = new UpperTriangular(new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, false); assertEquals(0, a.viewDiagonal().minus(new DenseVector(new double[]{1, 5, 8, 10})).norm(1), 1.0e-10); assertEquals(0, a.viewPart(0, 3, 1, 3).viewDiagonal().minus( new DenseVector(new double[]{2, 6, 9})).norm(1), 1.0e-10); assertEquals(4, a.get(0, 3), 1.0e-10); print(a); Matrix m = new DenseMatrix(4, 4).assign(a); assertEquals(0, m.minus(a).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10); print(m); assertEquals(0, m.transpose().times(m).minus(a.transpose().times(a)).aggregate( Functions.PLUS, Functions.ABS), 1.0e-10); assertEquals(0, m.plus(m).minus(a.plus(a)).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10); }
@Override public Matrix viewPart(int[] offset, int[] size) { return new MatrixView(this, offset, size); }
UpperTriangular extends AbstractMatrix { @Override public Matrix viewPart(int[] offset, int[] size) { return new MatrixView(this, offset, size); } }
UpperTriangular extends AbstractMatrix { @Override public Matrix viewPart(int[] offset, int[] size) { return new MatrixView(this, offset, size); } UpperTriangular(int n);  UpperTriangular(double[] data, boolean shallow);  UpperTriangular(Vector data);  UpperTriangular(UpperTriangular mx); }
UpperTriangular extends AbstractMatrix { @Override public Matrix viewPart(int[] offset, int[] size) { return new MatrixView(this, offset, size); } UpperTriangular(int n);  UpperTriangular(double[] data, boolean shallow);  UpperTriangular(Vector data);  UpperTriangular(UpperTriangular mx); @Override Matrix assignColumn(int column, Vector other); @Override Matrix assignRow(int row, Vector other); Matrix assignNonZeroElementsInRow(int row, double[] other); @Override double getQuick(int row, int column); @Override Matrix like(); @Override Matrix like(int rows, int columns); @Override void setQuick(int row, int column, double value); @Override int[] getNumNondefaultElements(); @Override Matrix viewPart(int[] offset, int[] size); double[] getData(); }
UpperTriangular extends AbstractMatrix { @Override public Matrix viewPart(int[] offset, int[] size) { return new MatrixView(this, offset, size); } UpperTriangular(int n);  UpperTriangular(double[] data, boolean shallow);  UpperTriangular(Vector data);  UpperTriangular(UpperTriangular mx); @Override Matrix assignColumn(int column, Vector other); @Override Matrix assignRow(int row, Vector other); Matrix assignNonZeroElementsInRow(int row, double[] other); @Override double getQuick(int row, int column); @Override Matrix like(); @Override Matrix like(int rows, int columns); @Override void setQuick(int row, int column, double value); @Override int[] getNumNondefaultElements(); @Override Matrix viewPart(int[] offset, int[] size); double[] getData();  }