.Modelica_LinearSystems2.Internal.reorderEigenvalue

Information

Syntax

               reorderedZero = Matrices.reorderZeros(complexVector);
(reorderedZeros, nRealZeros) = Matrices.reorderZeros(
                                 complexVector,
                                 name="complexVector");

Description

Function reorderZeros(..) reorders the zeros from the Complex vector "complexVector" such that the returned Complex vector reorderedZeros contains first all real Zeros and afterwards the conjugate complex zero pairs. It is required that all elements of complexVector define either a real zero (complexVector[i].im=0) or a conjugate complex zero pair (complexVector[i].re == complexVector[i+1].re and complexVector[i].im == -complexVector[i+1].im). The optional input argument "name" is used as name of "complexVector" in error messages.

The function returns the vector element reordered, as well as the number of real zeros (nRealZeros).

Example

  // c = {0, 1+2*j, 1-2*j, 2, -3, -1-1*j, -1+1*j};
  Real complexZeros[:] = fill(Complex(0), integer((size(c,1)-n)/2));
algorithm
  (reorderedZeros, nRealZeros) := reorderZeros(c);
  // reorderedZeros = {0, 2, (-3), 1+2*j, 1-2*j, -1+1*j, -1-1*j}
  // nRealZeros     = 3

Interface

function reorderEigenvalue
  extends Modelica.Icons.Function;
  import Modelica_LinearSystems2.Internal.Eigenvalue;
  input Eigenvalue EigenvalueVector[:] "Zeros of a polynomial with real coefficients, e.g., eigen values of a real matrix";
  input String name = "EigenvalueVector" "Name of complexVector to be used in error message";
  output Eigenvalue reorderedEigenvalues[size(EigenvalueVector, 1)] "Reordered zeros";
  output Integer nRealEigenvalues "Number of real zeros (EigenvalueVector[1:nRealEigenvalues] are the real zeros)";
end reorderEigenvalue;

Generated at 2024-12-26T19:25:54Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos