Class Householder
-
Method Summary
Modifier and TypeMethodDescriptionstatic CMatrixgetReflector(CVector normal) Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormalvector.static MatrixgetReflector(Vector normal) Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormalvector.static VectorComputes the vector \( v \) in of a Householder matrix \( H = I-2vv^{T} \) where \( H \) is a transformation matrix which reflects a vector across the plane normal tonormal.static voidhermLeftRightMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, Complex128[] workArray) Applies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \) to a Hermitian matrix \( A \) on both the left and right side.static voidleftMultReflector(CMatrix src, CVector householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \).static voidleftMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, int startRow, int endRow, Complex128[] workArray) Left multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \).static voidleftMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow, double[] workArray) Left multiplies a Householder matrix \( H = I - \alpha vv^{T} \), represented by the vector v, to another matrix A.static voidleftMultReflector(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \).static voidrightMultReflector(CMatrix src, CVector householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \).static voidrightMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \).static voidrightMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \).static voidrightMultReflector(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \).static voidsymmLeftRightMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, double[] workArray) Applies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \) to a symmetric matrix \( A \) on both the left and right side.
-
Method Details
-
getReflector
Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormalvector.- Parameters:
normal- The vector normal to the plane the Householder reflector will reflect through.- Returns:
- A transformation matrix which describes a reflection through a plane containing the origin with the
specified
normalvector, i.e. a Householder reflector.
-
getVector
Computes the vector \( v \) in of a Householder matrix \( H = I-2vv^{T} \) where \( H \) is a transformation matrix which reflects a vector across the plane normal tonormal.This method may be used in conjunction with
leftMultReflector(Matrix, Vector, double, int, int, int)andrightMultReflector(Matrix, Vector, double, int, int, int)to efficiently apply reflectors. Doing this is \( O\left(n^2\right) \) while forming the full Householder matrix and performing matrix multiplication is \( O\left(n^3\right) \).- Parameters:
normal- Vector normal to the plane which \( H \) reflects across.- Returns:
- The vector \( v \) in of a Householder matrix
\( H = I-2vv^{T} \) which reflects across a plane
normal to
normal.
-
getReflector
Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormalvector.This method may be used in conjunction with
leftMultReflector(CMatrix, CVector, Complex128, int, int, int)andrightMultReflector(CMatrix, CVector, Complex128, int, int, int)to efficiently apply reflectors. Doing this is \( O\left(n^2\right) \) while forming the full Householder matrix and performing matrix multiplication is \( O\left(n^3\right) \)- Parameters:
normal- The vector normal to the plane the Householder reflector will reflect through\.- Returns:
- A transformation matrix which describes a reflection through a plane containing the origin with the
specified
normalvector, i.e. a Householder reflector.
-
leftMultReflector
public static void leftMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow, double[] workArray) Left multiplies a Householder matrix \( H = I - \alpha vv^{T} \), represented by the vector v, to another matrix A. That is, computes \( HA = \left(I - \alpha vv^{T}\right)A \).- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.workArray- An array to store temporary column data. This can help both with cache performance and reducing unneeded garbage collection if this method is called repeatedly.
-
rightMultReflector
public static void rightMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( AH^{T} = A\left(I-\alpha vv^{T}\right)^{T} \).- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
leftMultReflector
public static void leftMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, int startRow, int endRow, Complex128[] workArray) Left multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( HA = \left(I-\alpha vv^{H}\right)A \).- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.workArray- An array to store temporary column data. This can help both with cache performance and reducing unneeded garbage collection if this method is called repeatedly.
-
rightMultReflector
public static void rightMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( AH^{H} = A\left(I-\alpha vv^{H}\right)^{H} \).- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
symmLeftRightMultReflector
public static void symmLeftRightMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, double[] workArray) Applies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \) to a symmetric matrix \( A \) on both the left and right side. That is, computes \( HAH^{T} \).
Note: no check is made to explicitly check that the
srcmatrix is actually symmetric.- Parameters:
src- Matrix to apply the Householder reflector to. Assumed to be square and symmetric. Upper triangular portion overwritten with the result.householderVector- Householder vector \( v \) from the definition of a Householder reflector matrix.alpha- The scalar α value in Householder reflector matrix definition.startCol- Starting column of sub-matrix insrcto apply reflector to.workArray- Array for storing temporary values during the computation. Contents will be overwritten.
-
leftMultReflector
public static void leftMultReflector(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( HA = \left(I-\alpha vv^{T} \right)A \).This method is significantly more efficient than forming the full Householder matrix and multiplying it to the other matrix.
- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
rightMultReflector
public static void rightMultReflector(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{T} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( AH^{T} = A\left(I-\alpha vv^{T}\right)^{T} \).This method is significantly more efficient than forming the full Householder matrix and multiplying it to the other matrix.
- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
leftMultReflector
public static void leftMultReflector(CMatrix src, CVector householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( HA = \left(I-\alpha vv^{H}\right)A \).This method is significantly more efficient than forming the full Householder matrix and multiplying it to the other matrix.
- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
rightMultReflector
public static void rightMultReflector(CMatrix src, CVector householderVector, Complex128 alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \), to another matrix \( A \). That is, computes \( AH^{H} = A\left(I-\alpha vv^{H}\right)^{H} \).This method is significantly more efficient than forming the full Householder matrix and multiplying it to the other matrix.
- Parameters:
src- Source matrix apply Householder vector to (modified).householderVector- Householder vector \( v \).alpha- Scalar value in Householder matrix.startCol- Starting column of sub-matrix insrcto apply reflector to.startRow- Starting row of sub-matrix insrcto apply reflector to.endRow- Starting row of sub-matrix insrcto apply reflector to.
-
hermLeftRightMultReflector
public static void hermLeftRightMultReflector(CMatrix src, Complex128[] householderVector, Complex128 alpha, int startCol, Complex128[] workArray) Applies a Householder matrix \( H = I-\alpha vv^{H} \), represented by the vector \( v \) to a Hermitian matrix \( A \) on both the left and right side. That is, computes \( HAH^{H} \).
Note: no check is made to explicitly check that the
srcmatrix is actually Hermitian.- Parameters:
src- Matrix to apply the Householder reflector to. Assumed to be square and Hermitian. Upper triangular portion overwritten with the result.householderVector- Householder vector \( v \) from the definition of a Householder reflector matrix.alpha- The scalar α value in Householder reflector matrix definition.startCol- Starting column of sub-matrix insrcto apply reflector to.workArray- Array for storing temporary values during the computation. Contents will be overwritten.
-