@Override public void addMultiple(AMatrix m, double factor) { checkRowCount(m.rowCount()); int cc = checkColumnCount(m.columnCount()); for (int i = 0; i < cc; i++) { getColumnView(i).addMultiple(m.getColumn(i), factor); } }
@Override public AMatrix innerProduct(AMatrix a) { if (a instanceof ADiagonalMatrix) { return innerProduct((ADiagonalMatrix) a); } else if (a instanceof Matrix) { return innerProduct((Matrix) a); } if (!(dimensions == a.rowCount())) throw new IllegalArgumentException(ErrorMessages.incompatibleShapes(this, a)); int acc = a.columnCount(); Matrix m = Matrix.create(dimensions, acc); for (int i = 0; i < dimensions; i++) { double dv = unsafeGetDiagonalValue(i); for (int j = 0; j < acc; j++) { m.unsafeSet(i, j, dv * a.unsafeGet(i, j)); } } return m; }
public CholeskyResult(AMatrix L) { this(L, IdentityMatrix.create(L.rowCount()), L.getTranspose()); }
@Override public ZeroVector innerProduct(AMatrix m) { if (m.rowCount() != length) throw new IllegalArgumentException("Incompatible vector*matrix sizes"); return ZeroVector.create(m.columnCount()); }
@Override public boolean isSameShape(AMatrix m) { return (dimensions == m.rowCount()) && (dimensions == m.columnCount()); }