Search in sources :

Example 11 with CardinalityException

use of org.apache.ignite.ml.math.exceptions.CardinalityException in project ignite by apache.

the class AbstractMatrix method inverse.

/** {@inheritDoc} */
@Override
public Matrix inverse() {
    if (rowSize() != columnSize())
        throw new CardinalityException(rowSize(), columnSize());
    //TODO: This decomposition should be cached
    LUDecomposition dec = new LUDecomposition(this);
    Matrix res = dec.solve(likeIdentity());
    dec.destroy();
    return res;
}
Also used : Matrix(org.apache.ignite.ml.math.Matrix) LUDecomposition(org.apache.ignite.ml.math.decompositions.LUDecomposition) CardinalityException(org.apache.ignite.ml.math.exceptions.CardinalityException)

Aggregations

CardinalityException (org.apache.ignite.ml.math.exceptions.CardinalityException)11 Matrix (org.apache.ignite.ml.math.Matrix)2 SingularMatrixException (org.apache.ignite.ml.math.exceptions.SingularMatrixException)2 Vector (org.apache.ignite.ml.math.Vector)1 LUDecomposition (org.apache.ignite.ml.math.decompositions.LUDecomposition)1 InsufficientDataException (org.apache.ignite.ml.math.exceptions.InsufficientDataException)1 NullArgumentException (org.apache.ignite.ml.math.exceptions.NullArgumentException)1