use of org.apache.ignite.ml.math.exceptions.NonSquareMatrixException in project ignite by apache.
the class Blas method syr.
/**
* A := alpha * x * x^T + A.
*
* @param alpha a real scalar that will be multiplied to x * x^T^.
* @param x the vector x that contains the n elements.
* @param a the symmetric matrix A. Size of n x n.
*/
void syr(Double alpha, Vector x, DenseLocalOnHeapMatrix a) {
int mA = a.rowSize();
int nA = a.columnSize();
if (mA != nA)
throw new NonSquareMatrixException(mA, nA);
if (mA != x.size())
throw new CardinalityException(x.size(), mA);
// TODO: IGNITE-5535, Process DenseLocalOffHeapVector
if (x instanceof DenseLocalOnHeapVector)
syr(alpha, x, a);
else if (x instanceof SparseLocalVector)
syr(alpha, x, a);
else
throw new IllegalArgumentException("Operation 'syr' does not support vector [class=" + x.getClass().getName() + "].");
}
Aggregations