org.ejml.alg.dense.decomposition.bidiagonal
Class BidiagonalDecompositionRow

java.lang.Object
  extended by org.ejml.alg.dense.decomposition.bidiagonal.BidiagonalDecompositionRow
All Implemented Interfaces:
BidiagonalDecomposition<DenseMatrix64F>, DecompositionInterface<DenseMatrix64F>

public class BidiagonalDecompositionRow
extends Object
implements BidiagonalDecomposition<DenseMatrix64F>

Performs a BidiagonalDecomposition using householder reflectors. This is efficient on wide or square matrices.

Author:
Peter Abeles

Constructor Summary
BidiagonalDecompositionRow()
           
BidiagonalDecompositionRow(int numElements)
          Creates a decompose that defines the specified amount of memory.
 
Method Summary
protected  void computeU(int k)
           
protected  void computeV(int k)
           
 boolean decompose(DenseMatrix64F A)
          Computes the decomposition of the provided matrix.
 DenseMatrix64F getB(DenseMatrix64F B, boolean compact)
          Returns the bidiagonal matrix.
 void getDiagonal(double[] diag, double[] off)
          Extracts the diagonal and off diagonal elements from the decomposition.
 double[] getGammasU()
          Returns gammas from the householder operations for the U matrix.
 double[] getGammasV()
          Returns gammas from the householder operations for the V matrix.
 DenseMatrix64F getU(DenseMatrix64F U, boolean transpose, boolean compact)
          Returns the orthogonal U matrix.
 DenseMatrix64F getUBV()
          The raw UBV matrix that is stored internally.
 DenseMatrix64F getV(DenseMatrix64F V, boolean transpose, boolean compact)
          Returns the orthogonal V matrix.
static DenseMatrix64F handleB(DenseMatrix64F B, boolean compact, int m, int n, int min)
           
static DenseMatrix64F handleU(DenseMatrix64F U, boolean transpose, boolean compact, int m, int n, int min)
           
static DenseMatrix64F handleV(DenseMatrix64F V, boolean transpose, boolean compact, int m, int n, int min)
           
protected  void init(DenseMatrix64F A)
          Sets up internal data structures and creates a copy of the input matrix.
 boolean inputModified()
          Is the input matrix to DecompositionInterface.decompose(org.ejml.data.Matrix64F) is modified during the decomposition process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BidiagonalDecompositionRow

public BidiagonalDecompositionRow(int numElements)
Creates a decompose that defines the specified amount of memory.

Parameters:
numElements - number of elements in the matrix.

BidiagonalDecompositionRow

public BidiagonalDecompositionRow()
Method Detail

decompose

public boolean decompose(DenseMatrix64F A)
Computes the decomposition of the provided matrix. If no errors are detected then true is returned, false otherwise.

Specified by:
decompose in interface DecompositionInterface<DenseMatrix64F>
Parameters:
A - The matrix that is being decomposed. Not modified.
Returns:
If it detects any errors or not.

init

protected void init(DenseMatrix64F A)
Sets up internal data structures and creates a copy of the input matrix.

Parameters:
A - The input matrix. Not modified.

getUBV

public DenseMatrix64F getUBV()
The raw UBV matrix that is stored internally.

Returns:
UBV matrix.

getDiagonal

public void getDiagonal(double[] diag,
                        double[] off)
Description copied from interface: BidiagonalDecomposition
Extracts the diagonal and off diagonal elements from the decomposition.

Specified by:
getDiagonal in interface BidiagonalDecomposition<DenseMatrix64F>
Parameters:
diag - diagonal elements from B.
off - off diagonal elements form B.

getB

public DenseMatrix64F getB(DenseMatrix64F B,
                           boolean compact)
Returns the bidiagonal matrix.

Specified by:
getB in interface BidiagonalDecomposition<DenseMatrix64F>
Parameters:
B - If not null the results are stored here, if null a new matrix is created.
Returns:
The bidiagonal matrix.

handleB

public static DenseMatrix64F handleB(DenseMatrix64F B,
                                     boolean compact,
                                     int m,
                                     int n,
                                     int min)

getU

public DenseMatrix64F getU(DenseMatrix64F U,
                           boolean transpose,
                           boolean compact)
Returns the orthogonal U matrix.

Specified by:
getU in interface BidiagonalDecomposition<DenseMatrix64F>
Parameters:
U - If not null then the results will be stored here. Otherwise a new matrix will be created.
Returns:
The extracted Q matrix.

handleU

public static DenseMatrix64F handleU(DenseMatrix64F U,
                                     boolean transpose,
                                     boolean compact,
                                     int m,
                                     int n,
                                     int min)

getV

public DenseMatrix64F getV(DenseMatrix64F V,
                           boolean transpose,
                           boolean compact)
Returns the orthogonal V matrix.

Specified by:
getV in interface BidiagonalDecomposition<DenseMatrix64F>
Parameters:
V - If not null then the results will be stored here. Otherwise a new matrix will be created.
Returns:
The extracted Q matrix.

handleV

public static DenseMatrix64F handleV(DenseMatrix64F V,
                                     boolean transpose,
                                     boolean compact,
                                     int m,
                                     int n,
                                     int min)

computeU

protected void computeU(int k)

computeV

protected void computeV(int k)

getGammasU

public double[] getGammasU()
Returns gammas from the householder operations for the U matrix.

Returns:
gammas for householder operations

getGammasV

public double[] getGammasV()
Returns gammas from the householder operations for the V matrix.

Returns:
gammas for householder operations

inputModified

public boolean inputModified()
Description copied from interface: DecompositionInterface
Is the input matrix to DecompositionInterface.decompose(org.ejml.data.Matrix64F) is modified during the decomposition process.

Specified by:
inputModified in interface DecompositionInterface<DenseMatrix64F>
Returns:
true if the input matrix to decompose() is modified.


Copyright © 2012. All Rights Reserved.