vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
373 stars 109 forks source link

Feature request: methods to check matrix type are needed #229

Closed SamoylovMD closed 9 years ago

SamoylovMD commented 9 years ago

So, matrices can have some special forms, i.e. identical, diagonal, symmetric, skew-symmetric, upper/lower triangular. So, we could add these methods to Matrix interface:

interface Matrix {
    public boolean isIdentity();
    public boolean isDiagonal();
    ...
}
SamoylovMD commented 9 years ago

Also, it could be used widely in algorithms testing, for example when we use Cholesky decomposer, we need to check the argument is symmetric and the result is lower-triangular.

vkostyukov commented 9 years ago

We do have Matrix.is method that takes a MatrixPredicate and does exactly what you described.