public class HouseholderReflection extends Object
When H is applied to a set of column vectors, it transforms each vector individually, as in block matrix multiplication.H = I - 2vv' Hx = (I - 2vv')x = Ix - 2vv'x = x - 2v<v,x>, where x is a column vector yH = (H'y')' = (Hy')', where y is a row vector
When H is applied to a set of row vectors, it transforms each vector individually, as in block matrix multiplication. \[ AH = \begin{bmatrix} A_1H\\ A_2H\\ A_3H\\ A_4H\\ A_5H \end{bmatrix} \]H * A = H * [A1 A2 ... An] = [H * A1 H * A2 ... H * An]
Constructor and Description |
---|
HouseholderReflection(HouseholderContext ctx) |
HouseholderReflection(Vector v)
Construct a Householder matrix from the vector that defines the
hyperplane orthogonal to the vector.
|
HouseholderReflection(Vector v,
double beta,
double lambda) |
Modifier and Type | Method and Description |
---|---|
Vector |
definingVector()
Get the Householder defining vector which is orthogonal to the Householder hyperplane.
|
Matrix |
H()
Get the Householder matrix H = I - 2 * v * v'.
|
static Matrix |
product(HouseholderReflection[] Hs,
int from,
int to)
Compute Q from Householder matrices {Qi}.
|
static Matrix |
product(HouseholderReflection[] Hs,
int from,
int to,
int nRows,
int nCols)
Compute Q from Householder matrices {Qi}.
|
Matrix |
reflect(Matrix A)
Apply the Householder matrix, H, to a matrix (a set of column
vectors), A.
|
Vector |
reflect(Vector x)
Apply the Householder matrix, H, to a column vector, x.
|
Matrix |
reflectColumns(Matrix A) |
Matrix |
reflectRows(Matrix A) |
void |
reflectVectors(Vector[] vectors,
int startIndex,
int endIndex)
Apply the Householder matrix, H, to an array of vectors.
|
Matrix |
rightReflect(Matrix A)
Apply the Householder matrix, H, to a matrix (a set of row
vectors), A.
|
public HouseholderReflection(Vector v)
v
- the hyperplane defining vectorpublic HouseholderReflection(HouseholderContext ctx)
public HouseholderReflection(Vector v, double beta, double lambda)
public Vector definingVector()
public Vector reflect(Vector x)
Hx = x - 2 * <v,x> * v
x
- a vectorpublic void reflectVectors(Vector[] vectors, int startIndex, int endIndex)
vectors
- an array of vectorsstartIndex
- the start index of the array to applyendIndex
- the end index of the array to apply, inclusivepublic Matrix reflect(Matrix A)
H * A = [H * A1 H * A2 ... H * An]
A
- a matrixpublic Matrix rightReflect(Matrix A)
A
- a matrixpublic Matrix H()
reflect(Vector)
.public static Matrix product(HouseholderReflection[] Hs, int from, int to)
This implementation use an efficient way to compute Q, i.e., by applying Qi's repeatedly on an identity matrix.Q = Q1 * Q2 * ... * Qn * I
Hs
- an array of Householdersfrom
- the beginning index of H's; Q1 is
Qfromto
- the ending index of H's; Qn is
QtoHs[from]
to Hs[to]
public static Matrix product(HouseholderReflection[] Hs, int from, int to, int nRows, int nCols)
The identity matrix, I, may have more rows than columns. The bottom rows are padded with zeros. This implementation use an efficient way to compute Q, i.e., by applying Qi's repeatedly on an identity matrix.Q = Q1 * Q2 * ... * Qn * I
Hs
- an array of Householdersfrom
- the beginning index of H's; Q1 is
Qfromto
- the ending index of H's; Qn is
QtonRows
- the number of rows of InCols
- the number of columns of IHs[from]
to Hs[to]
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.