org.ejml.alg.block.linsol.qr
Class BlockQrHouseHolderSolver

java.lang.Object
  extended by org.ejml.alg.block.linsol.qr.BlockQrHouseHolderSolver
All Implemented Interfaces:
LinearSolver<BlockMatrix64F>

public class BlockQrHouseHolderSolver
extends Object
implements LinearSolver<BlockMatrix64F>

A solver for BlockMatrix64HouseholderQR. Systems are solved for using the standard QR decomposition method, sketched below.

A = Q*R
A*x = b
Q*R*x = b
R*x = y = QTb
x = R-1y

Where A is the m by n matrix being decomposed. Q is an orthogonal matrix. R is upper triangular matrix.

Author:
Peter Abeles

Field Summary
protected  BlockMatrix64HouseholderQR decomp
           
protected  BlockMatrix64F QR
           
 
Constructor Summary
BlockQrHouseHolderSolver()
           
 
Method Summary
 void invert(BlockMatrix64F A_inv)
          Invert by solving for against an identity matrix.
 boolean modifiesA()
          Returns true if the passed in matrix to LinearSolver.setA(org.ejml.data.Matrix64F) is modified.
 boolean modifiesB()
          Returns true if the passed in 'B' matrix to LinearSolver.solve(org.ejml.data.Matrix64F, org.ejml.data.Matrix64F) is modified.
 double quality()
          Computes the quality using diagonal elements the triangular R matrix in the QR decomposition.
 boolean setA(BlockMatrix64F A)
          Computes the QR decomposition of A and store the results in A.
 void solve(BlockMatrix64F B, BlockMatrix64F X)
           Solves for X in the linear system, A*X=B.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decomp

protected BlockMatrix64HouseholderQR decomp

QR

protected BlockMatrix64F QR
Constructor Detail

BlockQrHouseHolderSolver

public BlockQrHouseHolderSolver()
Method Detail

setA

public boolean setA(BlockMatrix64F A)
Computes the QR decomposition of A and store the results in A.

Specified by:
setA in interface LinearSolver<BlockMatrix64F>
Parameters:
A - The A matrix in the linear equation. Modified. Reference saved.
Returns:
true if the decomposition was successful.

quality

public double quality()
Computes the quality using diagonal elements the triangular R matrix in the QR decomposition.

Specified by:
quality in interface LinearSolver<BlockMatrix64F>
Returns:
Solutions quality.

solve

public void solve(BlockMatrix64F B,
                  BlockMatrix64F X)
Description copied from interface: LinearSolver

Solves for X in the linear system, A*X=B.

In some implementations 'B' and 'X' can be the same instance of a variable. Call LinearSolver.modifiesB() to determine if 'B' is modified.

Specified by:
solve in interface LinearSolver<BlockMatrix64F>
Parameters:
B - A matrix ℜ m × p. Might be modified.
X - A matrix ℜ n × p, where the solution is written to. Modified.

invert

public void invert(BlockMatrix64F A_inv)
Invert by solving for against an identity matrix.

Specified by:
invert in interface LinearSolver<BlockMatrix64F>
Parameters:
A_inv - Where the inverted matrix saved. Modified.

modifiesA

public boolean modifiesA()
Description copied from interface: LinearSolver
Returns true if the passed in matrix to LinearSolver.setA(org.ejml.data.Matrix64F) is modified.

Specified by:
modifiesA in interface LinearSolver<BlockMatrix64F>
Returns:
true if A is modified in setA().

modifiesB

public boolean modifiesB()
Description copied from interface: LinearSolver
Returns true if the passed in 'B' matrix to LinearSolver.solve(org.ejml.data.Matrix64F, org.ejml.data.Matrix64F) is modified.

Specified by:
modifiesB in interface LinearSolver<BlockMatrix64F>
Returns:
true if B is modified in solve(B,X).


Copyright © 2012. All Rights Reserved.