public class Householder
extends java.lang.Object
implements java.io.Serializable
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]
| Modifier and Type | Class and Description |
|---|---|
static class |
Householder.Context
This is the context information about a Householder transformation.
|
| Constructor and Description |
|---|
Householder(Vector generator)
Construct a Householder matrix from the vector that defines the hyperplane orthogonal to the vector.
|
| Modifier and Type | Method and Description |
|---|---|
Vector |
generator()
Get the Householder generating vector.
|
static Householder.Context |
getContext(Vector x)
Generate the context information from a generating vector x.
|
Matrix |
H()
Get the Householder matrix H = I - 2 * v * v'.
|
static Matrix |
product(Householder[] Hs,
int from,
int to)
Compute Q from Householder matrices {Qi}.
|
static Matrix |
product(Householder[] 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 |
reflectRows(Matrix A)
Apply the Householder matrix, H, to a matrix (a set of row vectors), A.
|
public Householder(Vector generator)
generator - the hyperplane defining vectorpublic Vector generator()
public Vector reflect(Vector x)
Hx = x - 2 * <v,x> * v
x - a vectorpublic Matrix reflect(Matrix A)
H * A = [H * A1 H * A2 ... H * An]
A - a matrixpublic Matrix reflectRows(Matrix A)
A - a matrixpublic Matrix H()
reflect(Vector).public static Matrix product(Householder[] 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]public static Matrix product(Householder[] 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 Householder.Context getContext(Vector x)
That is,Hx = ±||x|| * e1
H.reflect(x) == new Vector(new double[]{±x.norm(), 0, ...})
x - a vector