@Override public Vector times( final Matrix matrix) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertDimensionalityEquals(matrix.getNumRows()); final int n = matrix.getNumColumns(); final Vector result = this.getVectorFactory().createVector(n); for (final MatrixEntry entry : matrix) { result.increment(entry.getColumnIndex(), this.get(entry.getRowIndex()) * entry.getValue()); } return result; }
@Override public Vector stack( final Vector other) { final int d1 = this.getDimensionality(); final int d2 = other.getDimensionality(); final Vector stacked = this.getVectorFactory().createVector(d1 + d2); for (final VectorEntry e : this) { stacked.setElement(e.getIndex(), e.getValue()); } for (final VectorEntry e : other) { stacked.setElement(d1 + e.getIndex(), e.getValue()); } return stacked; }
@Override public Vector stack( final Vector other) { final int d1 = this.getDimensionality(); final int d2 = other.getDimensionality(); final Vector stacked = this.getVectorFactory().createVector(d1 + d2); for (final VectorEntry e : this) { stacked.setElement(e.getIndex(), e.getValue()); } for (final VectorEntry e : other) { stacked.setElement(d1 + e.getIndex(), e.getValue()); } return stacked; }
@Override public Vector times( final Matrix matrix) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertDimensionalityEquals(matrix.getNumRows()); final int n = matrix.getNumColumns(); final Vector result = this.getVectorFactory().createVector(n); for (final MatrixEntry entry : matrix) { result.increment(entry.getColumnIndex(), this.get(entry.getRowIndex()) * entry.getValue()); } return result; }
@Override public Vector times( final Matrix matrix) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertDimensionalityEquals(matrix.getNumRows()); final int n = matrix.getNumColumns(); final Vector result = this.getVectorFactory().createVector(n); for (final MatrixEntry entry : matrix) { result.increment(entry.getColumnIndex(), this.get(entry.getRowIndex()) * entry.getValue()); } return result; }
@Override public Vector stack( final Vector other) { final int d1 = this.getDimensionality(); final int d2 = other.getDimensionality(); final Vector stacked = this.getVectorFactory().createVector(d1 + d2); for (final VectorEntry e : this) { stacked.setElement(e.getIndex(), e.getValue()); } for (final VectorEntry e : other) { stacked.setElement(d1 + e.getIndex(), e.getValue()); } return stacked; }
if (!other.isSparse()) result = this.getVectorFactory().getAssociatedMatrixFactory() .createMatrix(rowCount, columnCount);
if (!other.isSparse()) result = this.getVectorFactory().getAssociatedMatrixFactory() .createMatrix(rowCount, columnCount);
if (!other.isSparse()) result = this.getVectorFactory().getAssociatedMatrixFactory() .createMatrix(rowCount, columnCount);