reorderedZero = Internal.reorderZeros(complexVector);
(reorderedZeros, nRealZeros) = Internal.reorderZeros(complexVector,


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).


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


function reorderZeros
  import Modelica_LinearSystems2.Math.Complex;
  input Complex complexVector[:] "Zeros of a polynomial with real coefficients, e.g., eigen values of a real matrix";
  input String name = "complexVector" "Name of complexVector to be used in error message";
  output Complex reorderedZeros[size(complexVector, 1)] "Reordered zeros";
  output Integer nRealZeros = numberOfRealZeros(complexVector) "Number of real zeros (reorderedZeros[1:nRealZeros] are the real zeros)";
end reorderZeros;

Generated at 2020-04-02T01:37:38Z by OpenModelicaOpenModelica 1.16.0~dev-259-g8a5138f using GenerateDoc.mos