org.ojalgo.matrix.decomposition
Class QRDecomposition<N extends Number>

java.lang.Object
  extended by org.ojalgo.matrix.decomposition.QRDecomposition<N>
All Implemented Interfaces:
MatrixDecomposition<N>, QR<N>

public abstract class QRDecomposition<N extends Number>
extends Object
implements QR<N>


Nested Class Summary
static interface QRDecomposition.Store<N extends Number>
           Only classes that will act as a delegate to QRDecomposition should implement this interface.
 
Field Summary
static boolean DEBUG
           
 
Method Summary
 boolean compute(MatrixStore<N> aStore)
           
 boolean equals(MatrixDecomposition<N> aDecomp, NumberContext aCntxt)
           
 boolean equals(MatrixStore<N> aStore, NumberContext aCntxt)
           
 boolean equals(Object someObj)
           
 MatrixStore<N> getInverse()
          The output must be a "right inverse" and a "generalised inverse".
 MatrixStore<N> getQ()
           
 MatrixStore<N> getR()
           
 int getRank()
           
 List<Householder<N>> getTransformations()
           
 MatrixStore<N> invert(MatrixStore<N> aStore)
          A convenience method that produces exactly the same result as if you first call MatrixDecomposition.compute(MatrixStore) and then MatrixDecomposition.getInverse().
 boolean isComputed()
           
 boolean isFullColumnRank()
          The QR decompostion always exists, even if the matrix does not have full column rank, so the compute method will never fail.
 boolean isFullSize()
           
 boolean isSolvable()
           
static QR<BigDecimal> makeBig()
           
static QR<ComplexNumber> makeComplex()
           
static QR<Double> makeJama()
           
static QR<Double> makePrimitive()
           
 void reset()
           
 MatrixStore<N> solve(MatrixStore<N> aRHS)
          Solve [A]*[X]=[B] by first solving [Q]*[Y]=[B] and then [R]*[X]=[Y].
 Future<DecomposeAndSolve<N>> solve(MatrixStore<N> aBody, MatrixStore<N> aRHS)
          Will solve [aBody][X]=[aRHS] concurrently by first calling MatrixDecomposition.compute(MatrixStore) using [aBody], and then MatrixDecomposition.solve(MatrixStore) using [aRHS].
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
equals, invert, isComputed, reset, solve
 

Field Detail

DEBUG

public static boolean DEBUG
Method Detail

makeBig

public static final QR<BigDecimal> makeBig()

makeComplex

public static final QR<ComplexNumber> makeComplex()

makeJama

public static final QR<Double> makeJama()

makePrimitive

public static final QR<Double> makePrimitive()

compute

public boolean compute(MatrixStore<N> aStore)
Specified by:
compute in interface MatrixDecomposition<N extends Number>
Parameters:
aStore - A matrix to decompose
Returns:
true if the computation suceeded; false if not

equals

public boolean equals(MatrixStore<N> aStore,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<N extends Number>

getInverse

public MatrixStore<N> getInverse()
Description copied from interface: MatrixDecomposition
The output must be a "right inverse" and a "generalised inverse".

Specified by:
getInverse in interface MatrixDecomposition<N extends Number>
See Also:
BasicMatrix.invert()

getQ

public MatrixStore<N> getQ()
Specified by:
getQ in interface QR<N extends Number>

getR

public MatrixStore<N> getR()
Specified by:
getR in interface QR<N extends Number>

getRank

public int getRank()
Specified by:
getRank in interface QR<N extends Number>

getTransformations

public List<Householder<N>> getTransformations()

isFullColumnRank

public boolean isFullColumnRank()
Description copied from interface: QR
The QR decompostion always exists, even if the matrix does not have full column rank, so the compute method will never fail. The primary use of the QR decomposition is in the least squares solution of overdetermined systems of simultaneous linear equations. This will fail if the matrix does not have full column rank. The rank must be equal to the number of columns.

Specified by:
isFullColumnRank in interface QR<N extends Number>
See Also:
QR.isFullColumnRank()

isFullSize

public final boolean isFullSize()
Specified by:
isFullSize in interface MatrixDecomposition<N extends Number>
Returns:
True if the implementation generates a full sized decomposition.

isSolvable

public final boolean isSolvable()
Specified by:
isSolvable in interface MatrixDecomposition<N extends Number>
Returns:
true if it is ok to call MatrixDecomposition.solve(MatrixStore) (computation was successful); false if not
See Also:
MatrixDecomposition.solve(MatrixStore), MatrixDecomposition.isComputed()

solve

public MatrixStore<N> solve(MatrixStore<N> aRHS)
Solve [A]*[X]=[B] by first solving [Q]*[Y]=[B] and then [R]*[X]=[Y]. [X] minimises the 2-norm of [Q]*[R]*[X]-[B].

Specified by:
solve in interface MatrixDecomposition<N extends Number>
Parameters:
aRHS - The right hand side [B]
Returns:
[X]

equals

public boolean equals(MatrixDecomposition<N> aDecomp,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<N extends Number>

equals

public boolean equals(Object someObj)
Overrides:
equals in class Object

invert

public final MatrixStore<N> invert(MatrixStore<N> aStore)
Description copied from interface: MatrixDecomposition
A convenience method that produces exactly the same result as if you first call MatrixDecomposition.compute(MatrixStore) and then MatrixDecomposition.getInverse().

Specified by:
invert in interface MatrixDecomposition<N extends Number>

isComputed

public boolean isComputed()
Specified by:
isComputed in interface MatrixDecomposition<N extends Number>
Returns:
true if computation has been attemped; false if not.
See Also:
MatrixDecomposition.compute(MatrixStore), MatrixDecomposition.isSolvable()

reset

public void reset()
Specified by:
reset in interface MatrixDecomposition<N extends Number>

solve

public Future<DecomposeAndSolve<N>> solve(MatrixStore<N> aBody,
                                          MatrixStore<N> aRHS)
Description copied from interface: MatrixDecomposition
Will solve [aBody][X]=[aRHS] concurrently by first calling MatrixDecomposition.compute(MatrixStore) using [aBody], and then MatrixDecomposition.solve(MatrixStore) using [aRHS]. If either of the input [aBody] or [aRHS] is set to null the corresponing calculation is skipped.

Specified by:
solve in interface MatrixDecomposition<N extends Number>
Parameters:
aBody - The equation system body
aRHS - The equation system right hand side
Returns:
The matrix decomposition and the equation system solution, [X]