functionhouseholderReflexion
Reflect each of the vectors ai of matrix A=[a1, a2, ..., an] on a plane with orthogonal vector u
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
Matrices.householderReflection(A,u);
Description
This function computes the Housholder reflection (transformation)
Ar = Q*A
with
Q = I -2*u*u'/(u'*u)
where u*u is housholder vector, i.e. the normal vector of the reflection plane.
Householder reflection is widely used in numerical linear algebra, e.g. to perform QR decompositions.
Example
// First step of QR decomposition
Real A[3,3] = [1,2,3;
3,4,5;
2,1,4];
Real Ar[3,3];
Real u[:];
u = Modelica_LinearSystems2.Math.Vectors.householderVector(A[:,1],{1,0,0});
// u = {0.763, 0.646, 0}
Ar = householderReflexion(A,u);
// Ar = [-6.0828, -5.2608, -4.4388;
// 0.0, -1.1508, -2.3016;
// 0.0, 2.0, 0.0]
See also
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[:,:] | A | Rectangular matrix | |
| Real[size(A, 1)] | u | Householder vector |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[size(A, 1),size(A, 2)] | RA | Reflexion of A |