packageVectors

Library of functions operating on vectors

Extends from Modelica.Icons.Package (Icon for standard packages).

Information

Library content

This library provides functions operating on vectors:

  • toString(v) - returns the string representation of vector v.
  • isEqual(v1, v2) - returns true if vectors v1 and v2 have the same size and the same elements.
  • norm(v,p) - returns the p-norm of vector v.
  • length(v) - returns the length of vector v (= norm(v,2), but inlined and therefore usable in symbolic manipulations)
  • normalize(v) - returns vector in direction of v with length = 1 and prevents zero-division for zero vector.
  • reverse(v) - reverses the vector elements of v.
  • sort(v) - sorts the elements of vector v in ascending or descending order.
  • find(e, v) - returns the index of the first occurrence of scalar e in vector v.
  • interpolate(x, y, xi) - returns the interpolated value in (x,y) that corresponds to xi.
  • relNodePositions(nNodes) - returns a vector of relative node positions (0..1).

See also

Matrices

Contents

NameDescription
toStringConvert a real vector in to a string representation
isEqualDetermine if two Real vectors are numerically identical
normReturn the p-norm of a vector
lengthReturn length of a vector (better as norm(), if further symbolic processing is performed)
normalizeReturn normalized vector such that length = 1 and prevent zero-division for zero vector
normalizeWithAssertReturn normalized vector such that length = 1 (trigger an assert for zero vector)
reverseReverse vector elements (e.g., v[1] becomes last element)
sortSort elements of vector in ascending or descending order
findFind element in a vector
interpolateInterpolate linearly in a vector
relNodePositionsReturn vector of relative node positions (0..1)