# Package Modelica.​Math.​Vectors.​UtilitiesUtility 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 Contents

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

## Function Modelica.​Math.​Vectors.​Utilities.​householderVectorCalculate 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
```

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

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

### Inputs

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

### Outputs

TypeNameDescription
`Real``u[size(a, 1)]`Householder vector to map a onto b

## Function Modelica.​Math.​Vectors.​Utilities.​householderReflectionReflect 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}
```

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

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

### Inputs

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

### Outputs

TypeNameDescription
`Real``ra[size(u, 1)]`reflexion of a

## Function Modelica.​Math.​Vectors.​Utilities.​rootsCompute 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

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

### Outputs

TypeNameDescription
`Real``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