|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.operation.Householder
public class Householder
A Householder transformation in the 3-dimensional space is the reflection of a vector in a plane. The plane, containing the origin, is uniquely defined by a unit vector, called the generator, orthogonal to the plane.
The reflection Hx can be computed without explicitly expanding H.
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 column vectors, it transforms each vector individually, as in block matrix multiplication.
H %*% A = H %*% [A1 A2 ... An] = [H %*% A1 H %*% A2 ... H %*% An]
When H is applied to a set of row vectors, it transforms each vector individually, as in block matrix multiplication.
| (H %*% A1')' |
| (H %*% A2')' |
A %*% H = | (H %*% A3')' |
| (H %*% A4')' |
| (H %*% A5')' |
| Nested Class Summary | |
|---|---|
static class |
Householder.Context
Context information about a Householder transformation. |
| Constructor Summary | |
|---|---|
Householder(Vector generator)
Construct a Householder matrix from a vector that defines a hyperplane orthogonal to the vector. |
|
| Method Summary | |
|---|---|
Vector |
generator()
Get a copy of the Householder generating vector. |
static Householder.Context |
getContext(Vector x)
Generate the getContext information from a vector x. |
Matrix |
H()
Get a copy of the Householder matrix H. |
static Matrix |
product(Householder[] Hs,
int from,
int to)
Given Householder matrix {Qi},
compute Q, where
Q = Q1 %*% Q2 %*% ... %*% Qn %*% I
To compute Q,
instead of explicitly doing this multiplication, we can improve the performance
by applying Qi's repeatedly on the Identity matrix. |
static Matrix |
product(Householder[] hhs,
int from,
int to,
int nRows,
int nCols)
Given Householder matrices {Qi},
compute Q. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Householder(Vector generator)
generator - the orthogonal defining vector| Method Detail |
|---|
public Vector generator()
public Vector reflect(Vector x)
H, to a column vector, x.
Hx = x - 2 * <v,x> * v
x - the vector to apply H to
Hxpublic Matrix reflect(Matrix A)
H, to a matrix (a set of column vectors), A.
H %*% A = [H*A1, H*A2, ... H*An]
A - the matrix to apply H to
H %*% Apublic Matrix reflectRows(Matrix A)
H, to a matrix (a set of row vectors), A.
| (H %*% A1')' |
| (H %*% A2')' |
A %*% H = | (H %*% A3')' |
| (H %*% A4')' |
| (H %*% A5')' |
A - the matrix to apply H to
A %*% Hpublic Matrix H()
H.
H = I - 2 * v * v'
If you are to compute H %*% v, do not use this function.
Use reflect(Vector) instead.
public static Matrix product(Householder[] hhs,
int from,
int to,
int nRows,
int nCols)
{Qi},
compute Q.
Q = Q1 %*% Q2 %*% ... %*% Qn %*% I
The Identity matrix, I, can have more rows than columns.
The bottom rows are padded with zeros.
To compute Q,
instead of explicitly doing this multiplication, we can improve the performance
by applying Qi's repeatedly on the Identity matrix.
hhs - an array of Householdersfrom - the beginning index of Hs; Q1 is Q_fromto - the ending index of Hs; Qn is Q_tonRows - number of rows of InCols - number of columns of I
Hs[from] to Hs[to]
public static Matrix product(Householder[] Hs,
int from,
int to)
{Qi},
compute Q, where
Q = Q1 %*% Q2 %*% ... %*% Qn %*% I
To compute Q,
instead of explicitly doing this multiplication, we can improve the performance
by applying Qi's repeatedly on the Identity matrix.
Hs - an array of Householdersfrom - the beginning index of Hsto - the ending index of Hs
Hs[from] to Hs[to]public static Householder.Context getContext(Vector x)
x.
We implemented a modified version of
Algorithm 1.1 in Matrix Algorithms, Volume 1 by G. W. Steward
Given a vector x, return a vector generator, such that
Hx = ±||x|| * e1
That is,
H.reflect(x) == new Vector(new double[]{±x.norm(), 0, ...})
x - a vector
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||