Modelica_LinearSystems2.Math.Vectors

Functions operating on vectors

Information


Library content

This library provides functions operating on vectors:

Function Description
isEqual(v1, v2) Determines whether two vectors have the same size and elements
norm(v,p) p-norm of vector v
length(v) Length of vector v (= norm(v,2), but inlined and therefore usable in symbolic manipulations)
normalize(v) Return normalized vector such that length = 1 and prevent zero-division for zero vector
reverse(v) Reverse vector elements
sort(v) Sort elements of vector in ascending or descending order

See also

Matrices

Extends from Modelica.Icons.Library (Icon for library).

Package Content

NameDescription
Modelica_LinearSystems2.Math.Vectors.find find find element in vector
Modelica_LinearSystems2.Math.Vectors.householderReflexion householderReflexion reflect vector a on a plane with orthogonal vector u
Modelica_LinearSystems2.Math.Vectors.householderReflexion_e1 householderReflexion_e1 reflect vector a to the unity vector e_1={1,0,...,0}
Modelica_LinearSystems2.Math.Vectors.householderReflexion_en householderReflexion_en reflect vector a to the unity vector e_n={0, ..., 0, 1}
Modelica_LinearSystems2.Math.Vectors.householderVector householderVector calculate a normalized householder vector for the reflexion of vector a onto vector b
Modelica_LinearSystems2.Math.Vectors.length length Return length of a vector
Modelica_LinearSystems2.Math.Vectors.printVector printVector print vector

Modelica_LinearSystems2.Math.Vectors.find Modelica_LinearSystems2.Math.Vectors.find

find element in vector

Information

Extends from Modelica.Icons.Function (Icon for a function).

Inputs

NameDescription
sSearch for s
v[:]Vector

Outputs

NameDescription
resultv[result] = s (first occurrence of s); result=0, if not found

Modelica_LinearSystems2.Math.Vectors.householderReflexion

reflect vector a on a plane with orthogonal vector u

Inputs

NameDescription
a[:] 
u[size(a, 1)]householder vector

Outputs

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

Modelica_LinearSystems2.Math.Vectors.householderReflexion_e1

reflect vector a to the unity vector e_1={1,0,...,0}

Inputs

NameDescription
a[:] 
u[size(a, 1)]householder vector

Outputs

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

Modelica_LinearSystems2.Math.Vectors.householderReflexion_en

reflect vector a to the unity vector e_n={0, ..., 0, 1}

Inputs

NameDescription
a[:] 
u[size(a, 1)]householder vector

Outputs

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

Modelica_LinearSystems2.Math.Vectors.householderVector

calculate a normalized householder vector for the reflexion of vector a onto vector b

Information


Syntax

Vectors.householderVector(a, b);

Description

The function call "householderVector(a, b)" returns vector u, which is the normalized Householder vector for a Householder reflexion with matrix Q

Q = I - 2*u*u'

with

Q*a = c*b

Inputs

NameDescription
a[:] 
b[size(a, 1)] 

Outputs

NameDescription
u[size(a, 1)] 

Modelica_LinearSystems2.Math.Vectors.length

Return length of a vector

Information


Syntax

Vectors.length(v);

Description

The function call "Vectors.length(v)" returns the Euclidean length "sqrt(v*v)" of vector v. The function call is equivalent to Vectors.norm(v). The advantage of length(v) over norm(v)"is that function length(..) is implemented in one statement and therefore the function is usually automatically inlined. Further symbolic processing is therefore possible, which is not the case with function norm(..).

Example

  v = {2, -4, -2, -1};
  length(v);  // = 5

See also

Vectors.norm

Inputs

NameDescription
v[:]Vector

Outputs

NameDescription
resultLength of vector v

Modelica_LinearSystems2.Math.Vectors.printVector

print vector

Inputs

NameDescription
v[:] 
significantDigitsNumber of significant digits that are shown
nameIndependent variable name used for printing

Outputs

NameDescription
s 

HTML-documentation generated by Dymola Tue Sep 08 18:52:57 2009.