/** * Creates a new {@link ValuesListView} for this matrix. */ public ValuesListView() { super(); this.rowCount = getNumRows(); this.columnCount = getNumColumns(); this.size = this.rowCount * this.columnCount; }
@Override public boolean checkMultiplicationDimensions( final Matrix postMultiplicationMatrix) { return this.getNumColumns() == postMultiplicationMatrix.getNumRows(); }
@Override public boolean isSquare() { return this.getNumRows() == this.getNumColumns(); }
@Override public boolean isSquare() { return this.getNumRows() == this.getNumColumns(); }
/** * Creates a new {@link ValuesListView} for this matrix. */ public ValuesListView() { super(); this.rowCount = getNumRows(); this.columnCount = getNumColumns(); this.size = this.rowCount * this.columnCount; }
/** * Creates a new {@link ValuesListView} for this matrix. */ public ValuesListView() { super(); this.rowCount = getNumRows(); this.columnCount = getNumColumns(); this.size = this.rowCount * this.columnCount; }
@Override public boolean isSquare() { return this.getNumRows() == this.getNumColumns(); }
@Override public boolean checkMultiplicationDimensions( final Matrix postMultiplicationMatrix) { return this.getNumColumns() == postMultiplicationMatrix.getNumRows(); }
@Override public boolean checkMultiplicationDimensions( final Matrix postMultiplicationMatrix) { return this.getNumColumns() == postMultiplicationMatrix.getNumRows(); }
@Override public boolean checkSameDimensions( Matrix otherMatrix ) { return (this.getNumRows() == otherMatrix.getNumRows()) && (this.getNumColumns() == otherMatrix.getNumColumns()); }
@Override public boolean checkSameDimensions( Matrix otherMatrix ) { return (this.getNumRows() == otherMatrix.getNumRows()) && (this.getNumColumns() == otherMatrix.getNumColumns()); }
@Override public boolean checkSameDimensions( Matrix otherMatrix ) { return (this.getNumRows() == otherMatrix.getNumRows()) && (this.getNumColumns() == otherMatrix.getNumColumns()); }
@Override public Vector sumOfColumns() { final RingAccumulator<Vector> accumulator = new RingAccumulator<Vector>(); final int numColumns = this.getNumColumns(); for (int j = 0; j < numColumns; j++) { accumulator.accumulate(this.getColumn(j)); } return accumulator.getSum(); }
@Override public Vector sumOfColumns() { final RingAccumulator<Vector> accumulator = new RingAccumulator<Vector>(); final int numColumns = this.getNumColumns(); for (int j = 0; j < numColumns; j++) { accumulator.accumulate(this.getColumn(j)); } return accumulator.getSum(); }
@Override public Vector sumOfColumns() { final RingAccumulator<Vector> accumulator = new RingAccumulator<Vector>(); final int numColumns = this.getNumColumns(); for (int j = 0; j < numColumns; j++) { accumulator.accumulate(this.getColumn(j)); } return accumulator.getSum(); }
@Override public void assertSameDimensions( Matrix other ) { if (!this.checkSameDimensions(other)) { throw new DimensionalityMismatchException( "Matrices must have same dimensions: " + "(" + this.getNumRows() + "x" + this.getNumColumns() + ") !=" + "(" + other.getNumRows() + "x" + other.getNumColumns() + ")" ); } }
@Override public void assertSameDimensions( Matrix other ) { if (!this.checkSameDimensions(other)) { throw new DimensionalityMismatchException( "Matrices must have same dimensions: " + "(" + this.getNumRows() + "x" + this.getNumColumns() + ") !=" + "(" + other.getNumRows() + "x" + other.getNumColumns() + ")" ); } }
@Override public void assertSameDimensions( Matrix other ) { if (!this.checkSameDimensions(other)) { throw new DimensionalityMismatchException( "Matrices must have same dimensions: " + "(" + this.getNumRows() + "x" + this.getNumColumns() + ") !=" + "(" + other.getNumRows() + "x" + other.getNumColumns() + ")" ); } }
@Override public void assertMultiplicationDimensions( final Matrix postMultiplicationMatrix) { if (!this.checkMultiplicationDimensions(postMultiplicationMatrix)) { throw new DimensionalityMismatchException( "Matrices must have same internal dimensions: " + + this.getNumRows() + "x" + this.getNumColumns() + " != " + + postMultiplicationMatrix.getNumRows() + "x" + postMultiplicationMatrix.getNumColumns()); } }
@Override public Vector times( final Vector vector) { vector.assertDimensionalityEquals(this.getNumColumns()); final Vector result = vector.getVectorFactory().createVector( this.getNumRows()); for (final MatrixEntry entry : this) { result.increment(entry.getRowIndex(), entry.getValue() * vector.get(entry.getColumnIndex())); } return result; }