Class Householder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CMatrix
getReflector
(CVector normal) Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormal
vector.static Matrix
getReflector
(Vector normal) Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormal
vector.static Vector
Computes the vectorv
in of a Householder matrixH=I-2vv
T whereH
is a transformation matrix which reflects a vector across the plane normal tonormal
.static void
leftMultReflector
(CMatrix src, CVector householderVector, CNumber alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
.static void
leftMultReflector
(CMatrix src, CNumber[] householderVector, CNumber alpha, int startCol, int startRow, int endRow, CNumber[] workArray) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
.static void
leftMultReflector
(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow, double[] workArray) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
.static void
leftMultReflector
(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
.static void
rightMultReflector
(CMatrix src, CVector householderVector, CNumber alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
.static void
rightMultReflector
(CMatrix src, CNumber[] householderVector, CNumber alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
.static void
rightMultReflector
(Matrix src, double[] householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
.static void
rightMultReflector
(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
.static void
symmLeftRightMultReflector
(Matrix src, double[] householderVector, double alpha, int startCol, double[] workArray) Applies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
to a symmetric matrixA
on both the left and right side.
-
Constructor Details
-
Householder
private Householder()
-
-
Method Details
-
getReflector
Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormal
vector.- 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
normal
vector, i.e. a Householder reflector.
-
getVector
Computes the vectorv
in of a Householder matrixH=I-2vv
T whereH
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(n^2) while forming the full Householder matrix and performing matrix multiplication is O(n^3)- Parameters:
normal
- Vector normal to the plane whichH
reflects across.- Returns:
- The vector
v
in of a Householder matrixH=I-2vv
T which reflects across a plane normal tonormal
.
-
getReflector
Computes the Householder reflector which describes a reflection through a hyperplane containing the origin which is normal to the specifiednormal
vector.This method may be used in conjunction with
leftMultReflector(CMatrix, CVector, CNumber, int, int, int)
andrightMultReflector(CMatrix, CVector, CNumber, int, int, int)
to efficiently apply reflectors. Doing this is O(n^2) while forming the full Householder matrix and performing matrix multiplication is O(n^3)- 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
normal
vector, 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 matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
. That is, computesH
T*A = (I-
invalid input: '&alpha'vv
T)
T*A
.- Parameters:
src
- Source matrix apply Householder vector to (modified).householderVector
- Householder vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to 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 matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
. That is, computesA*H = A*(I-
invalid input: '&alpha'vv
T)
.- Parameters:
src
- Source matrix apply Householder vector to (modified).householderVector
- Householder vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-
leftMultReflector
public static void leftMultReflector(CMatrix src, CNumber[] householderVector, CNumber alpha, int startCol, int startRow, int endRow, CNumber[] workArray) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
. That is, computesH*A = (I-
invalid input: '&alpha'vv
H)*A
.- Parameters:
src
- Source matrix apply Householder vector to (modified).householderVector
- Householder vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to 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, CNumber[] householderVector, CNumber alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
. That is, computesA*H = A*(I-
invalid input: '&alpha'vv
H)
.- Parameters:
src
- Source matrix apply Householder vector to (modified).householderVector
- Householder vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-
symmLeftRightMultReflector
public static void symmLeftRightMultReflector(Matrix src, double[] householderVector, double alpha, int startCol, double[] workArray) Applies a Householder matrix
H=I-
invalid input: '&alpha'vv
T, represented by the vectorv
to a symmetric matrixA
on both the left and right side. That is, computesH*A*H
.Note: no check is made to explicitly check that the
src
matrix 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 vectorv
from the definition of a Householder reflector matrix.alpha
- The scalar invalid input: '&alpha' value in Householder reflector matrix definition.startCol
- Starting column of sub-matrix insrc
to 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 matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
. That is, computesH*A = (I-
invalid input: '&alpha'vv
T)*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 vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-
rightMultReflector
public static void rightMultReflector(Matrix src, Vector householderVector, double alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
T, represented by the vectorv
, to another matrixA
. That is, computesA*H = A*(I-
invalid input: '&alpha'vv
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 vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-
leftMultReflector
public static void leftMultReflector(CMatrix src, CVector householderVector, CNumber alpha, int startCol, int startRow, int endRow) Left multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
. That is, computesH*A = (I-
invalid input: '&alpha'vv
H)*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 vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-
rightMultReflector
public static void rightMultReflector(CMatrix src, CVector householderVector, CNumber alpha, int startCol, int startRow, int endRow) Right multiplies a Householder matrixH=I-
invalid input: '&alpha'vv
H, represented by the vectorv
, to another matrixA
. That is, computesA*H = A*(I-
invalid input: '&alpha'vv
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 vectorv
.alpha
- Scalar value in Householder matrix.startCol
- Starting column of sub-matrix insrc
to apply reflector to.startRow
- Starting row of sub-matrix insrc
to apply reflector to.endRow
- Starting row of sub-matrix insrc
to apply reflector to.
-