Modelica.Math.Vectors.Utilities

Utility functions that should not be directly utilized by the user

Information


This package contains utility functions that are utilized by higher level vector and matrix functions. These functions are usually not useful for an end-user.

Extends from Modelica.Icons.UtilitiesPackage (Icon for utility packages).

Package Content

NameDescription
Modelica.Math.Vectors.Utilities.householderVector householderVector Calculate a normalized householder vector to reflect vector a onto vector b
Modelica.Math.Vectors.Utilities.householderReflection householderReflection Reflect a vector a on a plane with orthogonal vector u
Modelica.Math.Vectors.Utilities.roots roots Compute zeros of a polynomial where the highest coefficient is assumed as not to be zero

Modelica.Math.Vectors.Utilities.householderVector Modelica.Math.Vectors.Utilities.householderVector

Calculate a normalized householder vector to reflect vector a onto vector b

Information


Syntax

Vectors.Utilities.householderVector(a,b);

Description

The function call "householderVector(a, b)" returns the normalized Householder vector u for Householder reflection of input vector a onto vector b, i.e., Householder vector u is the normal vector of the reflection plane. Algebraically, the reflection is performed by transformation matrix Q

Q = I - 2*u*u',

i.e., vector a is mapped to

a -> Q*a=c*b

with scalar c, |c| = ||a|| / ||b||. Q*a is the reflection of a about the hyperplane orthogonal to u. Q is an orthogonal matrix, i.e.

Q = inv(Q) = Q'

Example

  a = {2, -4, -2, -1};
  b = {1, 0, 0, 0};

  u = householderVector(a,b);    // {0.837, -0.478, -0.239, -0.119}
                               // Computation (identity(4) - 2*matrix(u)*transpose(matrix(u)))*a results in
                               // {-5, 0, 0, 0} = -5*b

See also

Vectors.Utilities.householderReflection
Matrices.Utilities.householderReflection
Matrices.Utilities.householderSimilarityTransformation

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
a[:]Real vector to be reflected
b[size(a, 1)]Real vector b vector a is mapped onto

Outputs

NameDescription
u[size(a, 1)]Householder vector to map a onto b

Modelica.Math.Vectors.Utilities.householderReflection Modelica.Math.Vectors.Utilities.householderReflection

Reflect a vector a on a plane with orthogonal vector u

Information


Syntax

Vectors.Utilities.householderReflection(a,u);

Description

Function "householderReflection(a, u)" performs the reflection of vector a about a plane orthogonal to vector u (Householder vector). Algebraically the operation is defined by

b=Q*a

with

Q = I - 2*u*u',

where Q is an orthogonal matrix, i.e.

Q = inv(Q) = Q'

Example

  a = {2, -4, -2, -1};
  u = {0.837, -0.478, -0.239, -0.119};

  householderReflection(a,u);    //  = {-5.0, -0.001, -0.0005, -0.0044}

See also

Utilities.householderVector
Matrices.Utilities.householderReflection
Matrices.Utilities.householderSimilarityTransformation

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
a[:]Real vector a to be reflected
u[size(a, 1)]householder vector

Outputs

NameDescription
ra[size(u, 1)]reflexion of a

Modelica.Math.Vectors.Utilities.roots Modelica.Math.Vectors.Utilities.roots

Compute zeros of a polynomial where the highest coefficient is assumed as not to be zero

Information


Syntax

  r = Vectors.Utilities.roots(p);

Description

This function computes the roots of a polynomial P of x

  P = p[1]*x^n + p[2]*x^(n-1) + ... + p[n-1]*x + p[n+1];

with the coefficient vector p. It is assumed that the first element of p is not zero, i.e., that the polynomial is of order size(p,1)-1.

To compute the roots, the eigenvalues of the corresponding companion matrix C

         |-p[2]/p[1]  -p[3]/p[1]  ...  -p[n-2]/p[1]  -p[n-1]/p[1]  -p[n]/p[1] |
         |    1            0                0               0           0     |
         |    0            1      ...       0               0           0     |
  C =    |    .            .      ...       .               .           .     |
         |    .            .      ...       .               .           .     |
         |    0            0      ...       0               1           0     |

are calculated. These are the roots of the polynomial.
Since the companion matrix has already Hessenberg form, the transformation to Hessenberg form has not to be performed. Function eigenvaluesHessenberg
provides efficient eigenvalue computation for those matrices.

Example

  r = roots({1,2,3});
  // r = [-1.0,  1.41421356237309;
  //      -1.0, -1.41421356237309]
  // which corresponds to the roots: -1.0 +/- j*1.41421356237309

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
p[:]Vector with polynomial coefficients p[1]*x^n + p[2]*x^(n-1) + p[n]*x +p[n-1]

Outputs

NameDescription
roots[max(0, size(p, 1) - 1), 2]roots[:,1] and roots[:,2] are the real and imaginary parts of the roots of polynomial p

Automatically generated Mon Sep 23 17:21:10 2013.