public class GramSchmidt extends Object implements QRDecomposition
There is the problem of "loss of orthogonality" during the process. In general, the bigger the matrix is, e.g., dimension = 3500x3500, the less precise the result is. The vectors in Q may not be as orthogonal. This implementation uses a numerically stable GramSchmidt process with twice reorthogonalization to alleviate the problem of rounding errors.
Numerical determination of rank requires a criterion to decide how small a value should be treated as zero. This is a practical choice which depends on both the matrix and the application. For instance, for a matrix with a big first eigenvector, we should accordingly decrease the precision to compute the rank.
While the result for the orthogonal basis may match those of the Householder reflection
,
the result for the orthogonal complement may differ because the kernel basis is not unique.
Constructor and Description 

GramSchmidt(Matrix A)
Run the GramSchmidt process to orthogonalize a matrix.

GramSchmidt(Matrix A,
boolean pad0Cols,
double epsilon)
Run the GramSchmidt process to orthogonalize a matrix.

Modifier and Type  Method and Description 

PermutationMatrix 
P()
Get P, the pivoting matrix in the QR decomposition.

Matrix 
Q()
Get the orthogonal Q matrix in the QR decomposition, A = QR.

UpperTriangularMatrix 
R()
Get the upper triangular matrix R in the QR decomposition, A = QR.

int 
rank()
Get the numerical rank of A as computed by the QR decomposition.

Matrix 
squareQ()
Get the square Q matrix.

Matrix 
tallR()
Get the tall R matrix.

public GramSchmidt(Matrix A, boolean pad0Cols, double epsilon)
A
 a matrixpad0Cols
 when a column is linearly dependent on the previous columns, there is no orthogonal vector. We pad the basis with a 0vector.epsilon
 a precision parameter: when a number x ≤ ε, it is considered 0public GramSchmidt(Matrix A)
A
 a matrixpublic Matrix Q()
QRDecomposition
Q
in interface QRDecomposition
public UpperTriangularMatrix R()
QRDecomposition
R
in interface QRDecomposition
public PermutationMatrix P()
QRDecomposition
P
in interface QRDecomposition
public int rank()
QRDecomposition
rank
in interface QRDecomposition
public Matrix squareQ()
squareQ
in interface QRDecomposition
public Matrix tallR()
QRDecomposition
tallR
in interface QRDecomposition
Copyright © 20102018 Numerical Method Incorporation Limited. All Rights Reserved.