示例#1
0
  @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);
    }
  }
示例#2
0
 @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;
 }
示例#3
0
 public CholeskyResult(AMatrix L) {
   this(L, IdentityMatrix.create(L.rowCount()), L.getTranspose());
 }
示例#4
0
 @Override
 public ZeroVector innerProduct(AMatrix m) {
   if (m.rowCount() != length)
     throw new IllegalArgumentException("Incompatible vector*matrix sizes");
   return ZeroVector.create(m.columnCount());
 }
示例#5
0
 @Override
 public boolean isSameShape(AMatrix m) {
   return (dimensions == m.rowCount()) && (dimensions == m.columnCount());
 }