예제 #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());
 }