SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles
Class IsMatrix

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.IsMatrix

public class IsMatrix
extends java.lang.Object

This class collects the boolean operators that take a matrix or vector and check if it satisfies a certain property.


Method Summary
static boolean diagonal(Matrix A, double epsilon)
          Check if a square matrix is a diagonal matrix.
static boolean idempotent(Matrix A)
          Check if a matrix is idempotent.
static boolean identity(Matrix A, double epsilon)
          Check if a diagonal matrix is an identity matrix.
static boolean lowerBidiagonal(Matrix A, double epsilon)
          Check if a matrix is lower bidiagonal.
static boolean lowerTriangular(Matrix A, double epsilon)
          Check if a matrix is lower triangular.
static boolean magicSquare(Matrix A)
          Deprecated. Not supported yet.
static boolean orthogonal(Matrix A, double epsilon)
          Check if a matrix is orthogonal, up to a threshold.
static boolean positiveDefinite(Matrix A)
          Check if a square matrix is positive definite.
static boolean positiveSemiDefinite(Matrix A)
          Deprecated. Not supported yet.
static boolean quasiTriangular(Matrix A, double epsilon)
          Check if a matrix is quasi (upper) triangular.
static boolean reducedRowEchelonForm(Matrix A, double epsilon)
          Check if a matrix is in the reduced row echelon form.
static boolean rowEchelonForm(Matrix A, double epsilon)
          Check if a matrix is in the row echelon form.
static boolean scalar(Matrix A)
          Deprecated. Not supported yet.
static boolean singular(Matrix A, double epsilon)
          Dimension if a square matrix is singular, i.e having no inverse.
static boolean skewSymmetric(Matrix A)
          Check if a matrix is skew symmetric.
static boolean symmetric(Matrix A)
          Check if a matrix is symmetric.
static boolean symmetricPositiveDefinite(Matrix A)
          Check if a square matrix is symmetric and positive definite.
static boolean tridiagonal(Matrix A, double epsilon)
          Check if a matrix is tridiagonal.
static boolean upperBidiagonal(Matrix A, double epsilon)
          Check if a matrix is upper bidiagonal.
static boolean upperTriangular(Matrix A, double epsilon)
          Check if a matrix is upper triangular.
static boolean zero(Vector v, double epsilon)
          Check if a vector is a zero vector, i.e., all its entries are 0, up to a precision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

symmetric

public static boolean symmetric(Matrix A)
Check if a matrix is symmetric.

Parameters:
A - a matrix
Returns:
true iff
A.t() = A

skewSymmetric

public static boolean skewSymmetric(Matrix A)
Check if a matrix is skew symmetric.

Parameters:
A - a matrix
Returns:
true iff
A.t() = -A

idempotent

public static boolean idempotent(Matrix A)
Check if a matrix is idempotent.

Parameters:
A - a matrix
Returns:
true iff
A = A %*% A or A = A2

orthogonal

public static boolean orthogonal(Matrix A,
                                 double epsilon)
Check if a matrix is orthogonal, up to a threshold.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff
A.multiply(A.t()).equal(A.ONE())

magicSquare

@Deprecated
public static boolean magicSquare(Matrix A)
Deprecated. Not supported yet.

Check if a matrix is a magic square. Not yet implemented.

Parameters:
A - a matrix
Returns:
true iff A is a square matrix having distinct positive integers, arranged such that the sums of the numbers in any rows, columns, or diagonals are equal

singular

public static boolean singular(Matrix A,
                               double epsilon)
Dimension if a square matrix is singular, i.e having no inverse.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff A-1 does not exist

diagonal

public static boolean diagonal(Matrix A,
                               double epsilon)
Check if a square matrix is a diagonal matrix.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff A is square and Aij=0, for all i != j

identity

public static boolean identity(Matrix A,
                               double epsilon)
Check if a diagonal matrix is an identity matrix.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff A is square, and Aij=0 for all i != j, and Aij=1, for all i == j

upperTriangular

public static boolean upperTriangular(Matrix A,
                                      double epsilon)
Check if a matrix is upper triangular.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is upper triangular

lowerTriangular

public static boolean lowerTriangular(Matrix A,
                                      double epsilon)
Check if a matrix is lower triangular.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is lower triangular

quasiTriangular

public static boolean quasiTriangular(Matrix A,
                                      double epsilon)
Check if a matrix is quasi (upper) triangular.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is quasi (upper) triangular

upperBidiagonal

public static boolean upperBidiagonal(Matrix A,
                                      double epsilon)
Check if a matrix is upper bidiagonal.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is upper bidiagonal

lowerBidiagonal

public static boolean lowerBidiagonal(Matrix A,
                                      double epsilon)
Check if a matrix is lower bidiagonal.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is lower bidiagonal

tridiagonal

public static boolean tridiagonal(Matrix A,
                                  double epsilon)
Check if a matrix is tridiagonal.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is tridiagonal

rowEchelonForm

public static boolean rowEchelonForm(Matrix A,
                                     double epsilon)
Check if a matrix is in the row echelon form.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff matrix is in row echelon form
See Also:
Wikipedia: Row echelon form

reducedRowEchelonForm

public static boolean reducedRowEchelonForm(Matrix A,
                                            double epsilon)
Check if a matrix is in the reduced row echelon form.

Parameters:
A - a matrix
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff the matrix is in reduced row echelon form
See Also:
Wikipedia: Row echelon form

scalar

@Deprecated
public static boolean scalar(Matrix A)
Deprecated. Not supported yet.

Check if a square matrix is a scalar matrix.

Parameters:
A - a matrix
Returns:
true iff aij=0 for all i != j, and aij=some constant, for all i == j

symmetricPositiveDefinite

public static boolean symmetricPositiveDefinite(Matrix A)
Check if a square matrix is symmetric and positive definite.

Parameters:
A - a matrix
Returns:
true iff A is symmetric, and ztMz > 0, for all non-zero vectors z with real entries (z ∈ Rn)
See Also:
Wikipedia: Positive-definite matrix

positiveDefinite

public static boolean positiveDefinite(Matrix A)
Check if a square matrix is positive definite.

A real matrix A is positive definite iff the symmetric part

Asymmetric = 1/2 * (A + At)
is symmetric positive definite.

Parameters:
A - a matrix
Returns:
true iff A satisfies ztMz > 0, for all non-zero vectors z with real entries (z ∈ Rn)
See Also:
Wikipedia: Positive-definite matrix

positiveSemiDefinite

@Deprecated
public static boolean positiveSemiDefinite(Matrix A)
Deprecated. Not supported yet.

Check if a square matrix is positive definite.

Parameters:
A - a matrix
Returns:
true iff A satisfies ztMz >= 0, for all non-zero vectors z with real entries (z ∈ Rn)
See Also:
Wikipedia: Negative-definite, semidefinite and indefinite matrices

zero

public static boolean zero(Vector v,
                           double epsilon)
Check if a vector is a zero vector, i.e., all its entries are 0, up to a precision.

Parameters:
v - a vector
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
true iff v is a zero vector

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.