# .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+2j; 1-2j; 2; -3; -1-j; -1+j};
Real complexZeros[:] = fill(Complex(0), integer((size(c,1)-n)/2));
algorithm
(reorderedZeros, nRealZeros) := reorderZeros(c);
-> reorderedZeros = {0, 2, (-3), 1+2j, 1-2j, -1+j, -1-j}
nRealZeros     = 3

```

#### Interface

```function reorderEigenvalue
import Modelica_LinearSystems2.Math.Complex;
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 2020-04-02T01:37:38Z by OpenModelicaOpenModelica 1.16.0~dev-259-g8a5138f using GenerateDoc.mos