## Modelica_LinearSystems2.Math.Matrices.LAPACK

### Information

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

### Package Content

Name | Description
--- | ---
dgecon | Estimates the reciprocal of the condition number of a general real matrix A
dgees | Computes real Schur form T of real nonsymmetric matrix A, and, optionally, the matrix of Schur vectors Z as well as the eigenvalues
dgeev | Compute the eigenvalues and the (real) left and right eigenvectors of matrix A
dgeevx | Compute the eigenvalues and the (real) left and right eigenvectors of matrix A, using lapack routine dgeevx
dgegv | Compute generalized eigenvalues for a (A,B) system
dgehrd | reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q' * A * Q = H
dgeqp3 | computes a QR factorization with column pivoting
dgeqrf | computes a QR factorization without pivoting
dgesdd | Determine singular value decomposition
dgesvd | Determine singular value decomposition
dgesvx | Solve real system of linear equations op(A)*X=B, op(A) is A or A' according to the boolean input transposed
dgetrs | Solves a system of linear equations with the LU decomposition from dgetrf(..)
dggev | Compute generalized eigenvalues for a (A,B) system
dggevx | Compute generalized eigenvalues for a (A,B) system, using lapack routine dggevx
dhgeqz | Compute generalized eigenvalues for a (A,B) system
dhseqr | Compute eingenvalues of a matrix A using lapack routine DHSEQR for Hessenberg form matrix
dlange | Norm of a matrix
dlansy | Norm of a symmetric matrix
dorghr | generates a real orthogonal matrix Q which is defined as the product of IHI-ILO elementary reflectors of order N, as returned by DGEHRD
dorgqr | Generate a real orthogonal matrix Q which is defined as the product of elementary reflectors, as returned by DGEQRF
dorgqr_x | Generates a real orthogonal matrix Q which is defined as the product of elementary reflectors, as returned by DGEQRF
dormhr | overwrites the general real M-by-N matrix C with Q * C or C * Q or Q' * C or C * Q', where Q is an orthogonal matrix as returne by dgehrd
dormqr | overwrites the general real M-by-N matrix C with Q * C or C * Q or Q' * C or C * Q', where Q is an orthogonal matrix of a QR factorization as returned by dgeqrf
dtrevc | compute the right and/or left eigenvectors of a real upper quasi-triangular matrix T
dtrsen | DTRSEN reorders the real Schur factorization of a real matrix
dtrsyl | DTRSYL solves the real Sylvester matrix equation
dgelsx | Computes the minimum-norm solution to a real linear least squares problem with rank deficient A
dgemm | Blas algorithm to perform C:=a*op(A)*op(B) + b*C (a,b scalars, ABC matrices)
dtrmm | Blas algorithm to perform B := alpha*op( A )*B, or B := alpha*B*op( A ) with triangular matrix A
dpotrf | Computes the Cholesky factorization of a real symmetric positive definite matrix A
dtrsm | Solve one of the matrix equations op( A )*X = alpha*B, or X*op( A ) = alpha*B, where A is triangular matrix. BLAS routine
drot | Applies a plane rotation
drotg | Construct Givens plane rotation
dtrsv | Solve one of the matrix equations op( A )*x = B where A is upper or lower triangular matrix. BLAS routine
dposv | Compute the solution to A * X = B, where A is a symmetric positive definite matrix
dpocon | Estimates the reciprocal of the condition number (1-norm) of a real symmetric matrix A using the Cholesky factor
dgelqf | Compute LQ factorization of a real matrix A=L*Q
dorglq | Generate a matrix Q with orthonormal rows which is defined as the product of elementary reflectors, as returned by DGELQF

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgecon

Estimates the reciprocal of the condition number of a general real matrix A

### Information

      Purpose
        =======

        DGECON estimates the reciprocal of the condition number of a general
        real matrix A, in either the 1-norm or the infinity-norm, using
        the LU factorization computed by DGETRF.

        An estimate is obtained for norm(inv(A)), and the reciprocal of the
        condition number is computed as
           RCOND = 1 / ( norm(A) * norm(inv(A)) ).

        Arguments
        =========

        NORM    (input) CHARACTER*1
                Specifies whether the 1-norm condition number or the
                infinity-norm condition number is required:
                = '1' or 'O':  1-norm;
                = 'I':         Infinity-norm.

        N       (input) INTEGER
                The order of the matrix A.  N >= 0.

        A       (input) DOUBLE PRECISION array, dimension (LDA,N)
                The factors L and U from the factorization A = P*L*U
                as computed by DGETRF.

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).

        ANORM   (input) DOUBLE PRECISION
                If NORM = '1' or 'O', the 1-norm of the original matrix A.
                If NORM = 'I', the infinity-norm of the original matrix A.

        RCOND   (output) DOUBLE PRECISION
                The reciprocal of the condition number of the matrix A,
                computed as RCOND = 1/(norm(A) * norm(inv(A))).

        WORK    (workspace) DOUBLE PRECISION array, dimension (4*N)

        IWORK   (workspace) INTEGER array, dimension (N)

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value

        =====================================================================

### Inputs

Name | Description
--- | ---
LU_of_A[:, :] | LU factroization of a real matrix A
inf | Is true if infinity norm is used and false for 1-norm
anorm | norm of A

### Outputs

Name | Description
--- | ---
rcond | Reciprocal condition number of A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgees

Computes real Schur form T of real nonsymmetric matrix A, and, optionally, the matrix of Schur vectors Z as well as the eigenvalues

### Information

       Purpose
        =======

        DGEES computes for an N-by-N real nonsymmetric matrix A, the
        eigenvalues, the real Schur form T, and, optionally, the matrix of
        Schur vectors Z.  This gives the Schur factorization A = Z*T*(Z**T).

        Optionally, it also orders the eigenvalues on the diagonal of the
        real Schur form so that selected eigenvalues are at the top left.
        The leading columns of Z then form an orthonormal basis for the
        invariant subspace corresponding to the selected eigenvalues.

        A matrix is in real Schur form if it is upper quasi-triangular with
        1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the
        form
                [  a  b  ]
                [  c  a  ]

        where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).

        Arguments
        =========

        JOBVS   (input) CHARACTER*1
                = 'N': Schur vectors are not computed;
                = 'V': Schur vectors are computed.

        SORT    (input) CHARACTER*1
                Specifies whether or not to order the eigenvalues on the
                diagonal of the Schur form.
                = 'N': Eigenvalues are not ordered;
                = 'S': Eigenvalues are ordered (see SELECT).

        SELECT  (external procedure) LOGICAL FUNCTION of two DOUBLE PRECISION arguments
                SELECT must be declared EXTERNAL in the calling subroutine.
                If SORT = 'S', SELECT is used to select eigenvalues to sort
                to the top left of the Schur form.
                If SORT = 'N', SELECT is not referenced.
                An eigenvalue WR(j)+sqrt(-1)*WI(j) is selected if
                SELECT(WR(j),WI(j)) is true; i.e., if either one of a complex
                conjugate pair of eigenvalues is selected, then both complex
                eigenvalues are selected.
                Note that a selected complex eigenvalue may no longer
                satisfy SELECT(WR(j),WI(j)) = .TRUE. after ordering, since
                ordering may change the value of complex eigenvalues
                (especially if the eigenvalue is ill-conditioned); in this
                case INFO is set to N+2 (see INFO below).

        N       (input) INTEGER
                The order of the matrix A. N >= 0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the N-by-N matrix A.
                On exit, A has been overwritten by its real Schur form T.

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).

        SDIM    (output) INTEGER
                If SORT = 'N', SDIM = 0.
                If SORT = 'S', SDIM = number of eigenvalues (after sorting)
                               for which SELECT is true. (Complex conjugate
                               pairs for which SELECT is true for either
                               eigenvalue count as 2.)

        WR      (output) DOUBLE PRECISION array, dimension (N)
        WI      (output) DOUBLE PRECISION array, dimension (N)
                WR and WI contain the real and imaginary parts,
                respectively, of the computed eigenvalues in the same order
                that they appear on the diagonal of the output Schur form T.
                Complex conjugate pairs of eigenvalues will appear
                consecutively with the eigenvalue having the positive
                imaginary part first.

        VS      (output) DOUBLE PRECISION array, dimension (LDVS,N)
                If JOBVS = 'V', VS contains the orthogonal matrix Z of Schur
                vectors.
                If JOBVS = 'N', VS is not referenced.

        LDVS    (input) INTEGER
                The leading dimension of the array VS.  LDVS >= 1; if
                JOBVS = 'V', LDVS >= N.

        WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
                On exit, if INFO = 0, WORK(1) contains the optimal LWORK.

        LWORK   (input) INTEGER
                The dimension of the array WORK.  LWORK >= max(1,3*N).
                For good performance, LWORK must generally be larger.

                If LWORK = -1, then a workspace query is assumed; the routine
                only calculates the optimal size of the WORK array, returns
                this value as the first entry of the WORK array, and no error
                message related to LWORK is issued by XERBLA.

        BWORK   (workspace) LOGICAL array, dimension (N)
                Not referenced if SORT = 'N'.

        INFO    (output) INTEGER
                = 0: successful exit
                < 0: if INFO = -i, the i-th argument had an illegal value.
                > 0: if INFO = i, and i is
                   <= N: the QR algorithm failed to compute all the
                         eigenvalues; elements 1:ILO-1 and i+1:N of WR and WI
                         contain those eigenvalues which have converged; if
                         JOBVS = 'V', VS contains the matrix which reduces A
                         to its partially converged Schur form.
                   = N+1: the eigenvalues could not be reordered because some
                         eigenvalues were too close to separate (the problem
                         is very ill-conditioned);
                   = N+2: after reordering, roundoff changed values of some
                         complex eigenvalues so that leading eigenvalues in
                         the Schur form no longer satisfy SELECT=.TRUE.  This
                         could also be caused by underflow due to scaling.

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] | Square matrix

### Outputs

Name | Description
--- | ---
T[size(A, 1), size(A, 2)] | Real Schur form with A = Z*T*Z'
Z[size(A, 1), size(A, 1)] | orthogonal matrix Z of Schur vectors
eval_real[size(A, 1)] | real part of the eigenvectors of A
eval_imag[size(A, 1)] | imaginary part of the eigenvectors of A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgeev

Compute the eigenvalues and the (real) left and right eigenvectors of matrix A

### Information

       Purpose
       =======

       DGEEV computes for an N-by-N real nonsymmetric matrix A, the
       eigenvalues and, optionally, the left and/or right eigenvectors.

       The right eigenvector v(j) of A satisfies
                        A * v(j) = lambda(j) * v(j)
       where lambda(j) is its eigenvalue.
       The left eigenvector u(j) of A satisfies
                     u(j)**H * A = lambda(j) * u(j)**H
       where u(j)**H denotes the conjugate transpose of u(j).

       The computed eigenvectors are normalized to have Euclidean norm
       equal to 1 and largest component real.

       Arguments
       =========

       JOBVL   (input) CHARACTER*1
               = 'N': left eigenvectors of A are not computed;
               = 'V': left eigenvectors of A are computed.

       JOBVR   (input) CHARACTER*1
               = 'N': right eigenvectors of A are not computed;
               = 'V': right eigenvectors of A are computed.

       N       (input) INTEGER
               The order of the matrix A. N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the N-by-N matrix A.
               On exit, A has been overwritten.

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max(1,N).

       WR      (output) DOUBLE PRECISION array, dimension (N)
       WI      (output) DOUBLE PRECISION array, dimension (N)
               WR and WI contain the real and imaginary parts,
               respectively, of the computed eigenvalues.  Complex
               conjugate pairs of eigenvalues appear consecutively
               with the eigenvalue having the positive imaginary part
               first.

       VL      (output) DOUBLE PRECISION array, dimension (LDVL,N)
               If JOBVL = 'V', the left eigenvectors u(j) are stored one
               after another in the columns of VL, in the same order
               as their eigenvalues.
               If JOBVL = 'N', VL is not referenced.
               If the j-th eigenvalue is real, then u(j) = VL(:,j),
               the j-th column of VL.
               If the j-th and (j+1)-st eigenvalues form a complex
               conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and
               u(j+1) = VL(:,j) - i*VL(:,j+1).

       LDVL    (input) INTEGER
               The leading dimension of the array VL.  LDVL >= 1; if
               JOBVL = 'V', LDVL >= N.

       VR      (output) DOUBLE PRECISION array, dimension (LDVR,N)
               If JOBVR = 'V', the right eigenvectors v(j) are stored one
               after another in the columns of VR, in the same order
               as their eigenvalues.
               If JOBVR = 'N', VR is not referenced.
               If the j-th eigenvalue is real, then v(j) = VR(:,j),
               the j-th column of VR.
               If the j-th and (j+1)-st eigenvalues form a complex
               conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and
               v(j+1) = VR(:,j) - i*VR(:,j+1).

       LDVR    (input) INTEGER
               The leading dimension of the array VR.  LDVR >= 1; if
               JOBVR = 'V', LDVR >= N.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,3*N), and
               if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N.  For good
               performance, LWORK must generally be larger.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               > 0:  if INFO = i, the QR algorithm failed to compute all the
                     eigenvalues, and no eigenvectors have been computed;
                     elements i+1:N of WR and WI contain eigenvalues which
                     have converged.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag))
alphaImag[size(A, 1)] | Imaginary part of alpha (eigenvalue=(alphaReal+i*alphaImag))
lEigenVectors[size(A, 1), size(A, 1)] | left eigenvectors of matrix A
rEigenVectors[size(A, 1), size(A, 1)] | right eigenvectors of matrix A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgeevx

Compute the eigenvalues and the (real) left and right eigenvectors of matrix A, using lapack routine dgeevx

### Information

       Purpose
       =======

       DGEEVX computes for an N-by-N real nonsymmetric matrix A, the
       eigenvalues and, optionally, the left and/or right eigenvectors.

       Optionally also, it computes a balancing transformation to improve
       the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
       SCALE, and ABNRM), reciprocal condition numbers for the eigenvalues
       (RCONDE), and reciprocal condition numbers for the right
       eigenvectors (RCONDV).

       The right eigenvector v(j) of A satisfies
                        A * v(j) = lambda(j) * v(j)
       where lambda(j) is its eigenvalue.
       The left eigenvector u(j) of A satisfies
                     u(j)**H * A = lambda(j) * u(j)**H
       where u(j)**H denotes the conjugate transpose of u(j).

       The computed eigenvectors are normalized to have Euclidean norm
       equal to 1 and largest component real.

       Balancing a matrix means permuting the rows and columns to make it
       more nearly upper triangular, and applying a diagonal similarity
       transformation D * A * D**(-1), where D is a diagonal matrix, to
       make its rows and columns closer in norm and the condition numbers
       of its eigenvalues and eigenvectors smaller.  The computed
       reciprocal condition numbers correspond to the balanced matrix.
       Permuting rows and columns will not change the condition numbers
       (in exact arithmetic) but diagonal scaling will.  For further
       explanation of balancing, see section 4.10.2 of the LAPACK
       Users' Guide.

       Arguments
       =========

       BALANC  (input) CHARACTER*1
               Indicates how the input matrix should be diagonally scaled
               and/or permuted to improve the conditioning of its
               eigenvalues.
               = 'N': Do not diagonally scale or permute;
               = 'P': Perform permutations to make the matrix more nearly
                      upper triangular. Do not diagonally scale;
               = 'S': Diagonally scale the matrix, i.e. replace A by
                      D*A*D**(-1), where D is a diagonal matrix chosen
                      to make the rows and columns of A more equal in
                      norm. Do not permute;
               = 'B': Both diagonally scale and permute A.

               Computed reciprocal condition numbers will be for the matrix
               after balancing and/or permuting. Permuting does not change
               condition numbers (in exact arithmetic), but balancing does.

       JOBVL   (input) CHARACTER*1
               = 'N': left eigenvectors of A are not computed;
               = 'V': left eigenvectors of A are computed.
               If SENSE = 'E' or 'B', JOBVL must = 'V'.

       JOBVR   (input) CHARACTER*1
               = 'N': right eigenvectors of A are not computed;
               = 'V': right eigenvectors of A are computed.
               If SENSE = 'E' or 'B', JOBVR must = 'V'.

       SENSE   (input) CHARACTER*1
               Determines which reciprocal condition numbers are computed.
               = 'N': None are computed;
               = 'E': Computed for eigenvalues only;
               = 'V': Computed for right eigenvectors only;
               = 'B': Computed for eigenvalues and right eigenvectors.

               If SENSE = 'E' or 'B', both left and right eigenvectors
               must also be computed (JOBVL = 'V' and JOBVR = 'V').

       N       (input) INTEGER
               The order of the matrix A. N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the N-by-N matrix A.
               On exit, A has been overwritten.  If JOBVL = 'V' or
               JOBVR = 'V', A contains the real Schur form of the balanced
               version of the input matrix A.

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max(1,N).

       WR      (output) DOUBLE PRECISION array, dimension (N)
       WI      (output) DOUBLE PRECISION array, dimension (N)
               WR and WI contain the real and imaginary parts,
               respectively, of the computed eigenvalues.  Complex
               conjugate pairs of eigenvalues will appear consecutively
               with the eigenvalue having the positive imaginary part
               first.

       VL      (output) DOUBLE PRECISION array, dimension (LDVL,N)
               If JOBVL = 'V', the left eigenvectors u(j) are stored one
               after another in the columns of VL, in the same order
               as their eigenvalues.
               If JOBVL = 'N', VL is not referenced.
               If the j-th eigenvalue is real, then u(j) = VL(:,j),
               the j-th column of VL.
               If the j-th and (j+1)-st eigenvalues form a complex
               conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and
               u(j+1) = VL(:,j) - i*VL(:,j+1).

       LDVL    (input) INTEGER
               The leading dimension of the array VL.  LDVL >= 1; if
               JOBVL = 'V', LDVL >= N.

       VR      (output) DOUBLE PRECISION array, dimension (LDVR,N)
               If JOBVR = 'V', the right eigenvectors v(j) are stored one
               after another in the columns of VR, in the same order
               as their eigenvalues.
               If JOBVR = 'N', VR is not referenced.
               If the j-th eigenvalue is real, then v(j) = VR(:,j),
               the j-th column of VR.
               If the j-th and (j+1)-st eigenvalues form a complex
               conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and
               v(j+1) = VR(:,j) - i*VR(:,j+1).

       LDVR    (input) INTEGER
               The leading dimension of the array VR.  LDVR >= 1, and if
               JOBVR = 'V', LDVR >= N.

       ILO,IHI (output) INTEGER
               ILO and IHI are integer values determined when A was
               balanced.  The balanced A(i,j) = 0 if I > J and
               J = 1,...,ILO-1 or I = IHI+1,...,N.

       SCALE   (output) DOUBLE PRECISION array, dimension (N)
               Details of the permutations and scaling factors applied
               when balancing A.  If P(j) is the index of the row and column
               interchanged with row and column j, and D(j) is the scaling
               factor applied to row and column j, then
               SCALE(J) = P(J),    for J = 1,...,ILO-1
                        = D(J),    for J = ILO,...,IHI
                        = P(J)     for J = IHI+1,...,N.
               The order in which the interchanges are made is N to IHI+1,
               then 1 to ILO-1.

       ABNRM   (output) DOUBLE PRECISION
               The one-norm of the balanced matrix (the maximum
               of the sum of absolute values of elements of any column).

       RCONDE  (output) DOUBLE PRECISION array, dimension (N)
               RCONDE(j) is the reciprocal condition number of the j-th
               eigenvalue.

       RCONDV  (output) DOUBLE PRECISION array, dimension (N)
               RCONDV(j) is the reciprocal condition number of the j-th
               right eigenvector.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.   If SENSE = 'N' or 'E',
               LWORK >= max(1,2*N), and if JOBVL = 'V' or JOBVR = 'V',
               LWORK >= 3*N.  If SENSE = 'V' or 'B', LWORK >= N*(N+6).
               For good performance, LWORK must generally be larger.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       IWORK   (workspace) INTEGER array, dimension (2*N-2)
               If SENSE = 'N' or 'E', not referenced.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               > 0:  if INFO = i, the QR algorithm failed to compute all the
                     eigenvalues, and no eigenvectors or condition numbers
                     have been computed; elements 1:ILO-1 and i+1:N of WR
                     and WI contain eigenvalues which have converged.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag))
alphaImag[size(A, 1)] | Imaginary part of alpha (eigenvalue=(alphaReal+i*alphaImag))
lEigenVectors[size(A, 1), size(A, 1)] | left eigenvectors of matrix A
rEigenVectors[size(A, 1), size(A, 1)] | right eigenvectors of matrix A
AS[size(A, 1), size(A, 2)] | AS iss the real Schur form of the balanced version of the input matrix A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgegv

Compute generalized eigenvalues for a (A,B) system

### Information

       Purpose
       =======

       This routine is deprecated and has been replaced by routine DGGEV.

       DGEGV computes for a pair of n-by-n real nonsymmetric matrices A and
       B, the generalized eigenvalues (alphar +/- alphai*i, beta), and
       optionally, the left and/or right generalized eigenvectors (VL and
       VR).

       A generalized eigenvalue for a pair of matrices (A,B) is, roughly
       speaking, a scalar w or a ratio  alpha/beta = w, such that  A - w*B
       is singular.  It is usually represented as the pair (alpha,beta),
       as there is a reasonable interpretation for beta=0, and even for
       both being zero.  A good beginning reference is the book, "Matrix
       Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)

       A right generalized eigenvector corresponding to a generalized
       eigenvalue  w  for a pair of matrices (A,B) is a vector  r  such
       that  (A - w B) r = 0 .  A left generalized eigenvector is a vector
       l such that l**H * (A - w B) = 0, where l**H is the
       conjugate-transpose of l.

       Note: this routine performs "full balancing" on A and B -- see
       "Further Details", below.

       Arguments
       =========

       JOBVL   (input) CHARACTER*1
               = 'N':  do not compute the left generalized eigenvectors;
               = 'V':  compute the left generalized eigenvectors.

       JOBVR   (input) CHARACTER*1
               = 'N':  do not compute the right generalized eigenvectors;
               = 'V':  compute the right generalized eigenvectors.

       N       (input) INTEGER
               The order of the matrices A, B, VL, and VR.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA, N)
               On entry, the first of the pair of matrices whose
               generalized eigenvalues and (optionally) generalized
               eigenvectors are to be computed.
               On exit, the contents will have been destroyed.  (For a
               description of the contents of A on exit, see "Further
               Details", below.)

       LDA     (input) INTEGER
               The leading dimension of A.  LDA >= max(1,N).

       B       (input/output) DOUBLE PRECISION array, dimension (LDB, N)
               On entry, the second of the pair of matrices whose
               generalized eigenvalues and (optionally) generalized
               eigenvectors are to be computed.
               On exit, the contents will have been destroyed.  (For a
               description of the contents of B on exit, see "Further
               Details", below.)

       LDB     (input) INTEGER
               The leading dimension of B.  LDB >= max(1,N).

       ALPHAR  (output) DOUBLE PRECISION array, dimension (N)
       ALPHAI  (output) DOUBLE PRECISION array, dimension (N)
       BETA    (output) DOUBLE PRECISION array, dimension (N)
               On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
               be the generalized eigenvalues.  If ALPHAI(j) is zero, then
               the j-th eigenvalue is real; if positive, then the j-th and
               (j+1)-st eigenvalues are a complex conjugate pair, with
               ALPHAI(j+1) negative.

               Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
               may easily over- or underflow, and BETA(j) may even be zero.
               Thus, the user should avoid naively computing the ratio
               alpha/beta.  However, ALPHAR and ALPHAI will be always less
               than and usually comparable with norm(A) in magnitude, and
               BETA always less than and usually comparable with norm(B).

       VL      (output) DOUBLE PRECISION array, dimension (LDVL,N)
               If JOBVL = 'V', the left generalized eigenvectors.  (See
               "Purpose", above.)  Real eigenvectors take one column,
               complex take two columns, the first for the real part and
               the second for the imaginary part.  Complex eigenvectors
               correspond to an eigenvalue with positive imaginary part.
               Each eigenvector will be scaled so the largest component
               will have abs(real part) + abs(imag. part) = 1, *except*
               that for eigenvalues with alpha=beta=0, a zero vector will
               be returned as the corresponding eigenvector.
               Not referenced if JOBVL = 'N'.

       LDVL    (input) INTEGER
               The leading dimension of the matrix VL. LDVL >= 1, and
               if JOBVL = 'V', LDVL >= N.

       VR      (output) DOUBLE PRECISION array, dimension (LDVR,N)
               If JOBVR = 'V', the right generalized eigenvectors.  (See
               "Purpose", above.)  Real eigenvectors take one column,
               complex take two columns, the first for the real part and
               the second for the imaginary part.  Complex eigenvectors
               correspond to an eigenvalue with positive imaginary part.
               Each eigenvector will be scaled so the largest component
               will have abs(real part) + abs(imag. part) = 1, *except*
               that for eigenvalues with alpha=beta=0, a zero vector will
               be returned as the corresponding eigenvector.
               Not referenced if JOBVR = 'N'.

       LDVR    (input) INTEGER
               The leading dimension of the matrix VR. LDVR >= 1, and
               if JOBVR = 'V', LDVR >= N.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,8*N).
               For good performance, LWORK must generally be larger.
               To compute the optimal value of LWORK, call ILAENV to get
               blocksizes (for DGEQRF, DORMQR, and DORGQR.)  Then compute:
               NB  -- MAX of the blocksizes for DGEQRF, DORMQR, and DORGQR;
               The optimal LWORK is:
                   2*N + MAX( 6*N, N*(NB+1) ).

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               = 1,...,N:
                     The QZ iteration failed.  No eigenvectors have been
                     calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
                     should be correct for j=INFO+1,...,N.
               > N:  errors that usually indicate LAPACK problems:
                     =N+1: error return from DGGBAL
                     =N+2: error return from DGEQRF
                     =N+3: error return from DORMQR
                     =N+4: error return from DORGQR
                     =N+5: error return from DGGHRD
                     =N+6: error return from DHGEQZ (other than failed
                                                     iteration)
                     =N+7: error return from DTGEVC
                     =N+8: error return from DGGBAK (computing VL)
                     =N+9: error return from DGGBAK (computing VR)
                     =N+10: error return from DLASCL (various calls)

       Further Details
       ===============

       Balancing
       ---------

       This driver calls DGGBAL to both permute and scale rows and columns
       of A and B.  The permutations PL and PR are chosen so that PL*A*PR
       and PL*B*R will be upper triangular except for the diagonal blocks
       A(i:j,i:j) and B(i:j,i:j), with i and j as close together as
       possible.  The diagonal scaling matrices DL and DR are chosen so
       that the pair  DL*PL*A*PR*DR, DL*PL*B*PR*DR have elements close to
       one (except for the elements that start out zero.)

       After the eigenvalues and eigenvectors of the balanced matrices
       have been computed, DGGBAK transforms the eigenvectors back to what
       they would have been (in perfect arithmetic) if they had not been
       balanced.

       Contents of A and B on Exit
       -------- -- - --- - -- ----

       If any eigenvectors are computed (either JOBVL='V' or JOBVR='V' or
       both), then on exit the arrays A and B will contain the real Schur
       form[*] of the "balanced" versions of A and B.  If no eigenvectors
       are computed, then only the diagonal blocks will be correct.

       [*] See DHGEQZ, DGEGS, or read the book "Matrix Computations",
           by Golub & van Loan, pub. by Johns Hopkins U. Press.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |
B[size(A, 1), size(A, 1)] |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag)/beta)
alphaImag[size(A, 1)] | Imaginary part of alpha
beta[size(A, 1)] | Denominator of eigenvalue
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgehrd

reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q' * A * Q = H

### Information

       Purpose
       =======

       DGEHRD reduces a real general matrix A to upper Hessenberg form H by
       an orthogonal similarity transformation:  Q' * A * Q = H .

       Arguments
       =========

       N       (input) INTEGER
               The order of the matrix A.  N >= 0.

       ILO     (input) INTEGER
       IHI     (input) INTEGER
               It is assumed that A is already upper triangular in rows
               and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally
               set by a previous call to DGEBAL; otherwise they should be
               set to 1 and N respectively. See Further Details.
               1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the N-by-N general matrix to be reduced.
               On exit, the upper triangle and the first subdiagonal of A
               are overwritten with the upper Hessenberg matrix H, and the
               elements below the first subdiagonal, with the array TAU,
               represent the orthogonal matrix Q as a product of elementary
               reflectors. See Further Details.

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max(1,N).

       TAU     (output) DOUBLE PRECISION array, dimension (N-1)
               The scalar factors of the elementary reflectors (see Further
               Details). Elements 1:ILO-1 and IHI:N-1 of TAU are set to
               zero.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The length of the array WORK.  LWORK >= max(1,N).
               For optimum performance LWORK >= N*NB, where NB is the
               optimal blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.

       Further Details
       ===============

       The matrix Q is represented as a product of (ihi-ilo) elementary
       reflectors

          Q = H(ilo) H(ilo+1) . . . H(ihi-1).

       Each H(i) has the form

          H(i) = I - tau * v * v'

       where tau is a real scalar, and v is a real vector with
       v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on
       exit in A(i+2:ihi,i), and tau in TAU(i).

       The contents of A are illustrated by the following example, with
       n = 7, ilo = 2 and ihi = 6:

       on entry,                        on exit,

       ( a   a   a   a   a   a   a )    (  a   a   h   h   h   h   a )
       (     a   a   a   a   a   a )    (      a   h   h   h   h   a )
       (     a   a   a   a   a   a )    (      h   h   h   h   h   h )
       (     a   a   a   a   a   a )    (      v2  h   h   h   h   h )
       (     a   a   a   a   a   a )    (      v2  v3  h   h   h   h )
       (     a   a   a   a   a   a )    (      v2  v3  v4  h   h   h )
       (                         a )    (                          a )

       where a denotes an element of the original matrix A, h denotes a
       modified element of the upper Hessenberg matrix H, and vi denotes an
       element of the vector defining H(i).

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 2)] |
ilo | lowest index where the original matrix had been Hessenbergform
ihi | highest index where the original matrix had been Hessenbergform

### Outputs

Name | Description
--- | ---
Aout[size(A, 1), size(A, 2)] | contains the Hessenberg form in the upper triangle and the first subdiagonal and below the first subdiagonal it contains the elementary reflectors which represents (with array tau) as a product the orthogonal matrix Q
tau[max(size(A, 1), 1) - 1] | scalar factors of the elementary reflectors
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgeqp3

computes a QR factorization with column pivoting

### Information

       Purpose
       =======

       DGEQP3 computes a QR factorization with column pivoting of a
       matrix A:  A*P = Q*R  using Level 3 BLAS.

       Arguments
       =========

       M       (input) INTEGER
               The number of rows of the matrix A. M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix A.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the M-by-N matrix A.
               On exit, the upper triangle of the array contains the
               min(M,N)-by-N upper trapezoidal matrix R; the elements below
               the diagonal, together with the array TAU, represent the
               orthogonal matrix Q as a product of min(M,N) elementary
               reflectors.

       LDA     (input) INTEGER
               The leading dimension of the array A. LDA >= max(1,M).

       JPVT    (input/output) INTEGER array, dimension (N)
               On entry, if JPVT(J).ne.0, the J-th column of A is permuted
               to the front of A*P (a leading column); if JPVT(J)=0,
               the J-th column of A is a free column.
               On exit, if JPVT(J)=K, then the J-th column of A*P was the
               the K-th column of A.

       TAU     (output) DOUBLE PRECISION array, dimension (min(M,N))
               The scalar factors of the elementary reflectors.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO=0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK. LWORK >= 3*N+1.
               For optimal performance LWORK >= 2*N+( N+1 )*NB, where NB
               is the optimal blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0: successful exit.
               < 0: if INFO = -i, the i-th argument had an illegal value.

       Further Details
       ===============

       The matrix Q is represented as a product of elementary reflectors

          Q = H(1) H(2) . . . H(k), where k = min(m,n).

       Each H(i) has the form

          H(i) = I - tau * v * v'

       where tau is a real/complex scalar, and v is a real/complex vector
       with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in
       A(i+1:m,i), and tau in TAU(i).

       Based on contributions by
         G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
         X. Sun, Computer Science Dept., Duke University, USA

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] |
lwork1 | size of work array; should be optimized with Modelica_LinearSystems2.Math.Matrices.Internal.dgeqp3_workdim

### Outputs

Name | Description
--- | ---
Aout[size(A, 1), size(A, 2)] | the upper triangle of the array contains the upper trapezoidal matrix R; the elements below the diagonal, together with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors
jpvt[size(A, 2)] | pivoting indices
tau[min(size(A, 1), size(A, 2))] | scalar factors of the elementary reflectors
info |
work[max(lwork1, 3*size(A, 2) + 1)] |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgeqrf

computes a QR factorization without pivoting

### Information

       Purpose
       =======

       DGEQRF computes a QR factorization of a real M-by-N matrix A:
       A = Q * R.

       Arguments
       =========

       M       (input) INTEGER
               The number of rows of the matrix A.  M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix A.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the M-by-N matrix A.
               On exit, the elements on and above the diagonal of the array
               contain the min(M,N)-by-N upper trapezoidal matrix R (R is
               upper triangular if m >= n); the elements below the diagonal,
               with the array TAU, represent the orthogonal matrix Q as a
               product of min(m,n) elementary reflectors (see Further
               Details).

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max(1,M).

       TAU     (output) DOUBLE PRECISION array, dimension (min(M,N))
               The scalar factors of the elementary reflectors (see Further
               Details).

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,N).
               For optimum performance LWORK >= N*NB, where NB is
               the optimal blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value

       Further Details
       ===============

       The matrix Q is represented as a product of elementary reflectors

          Q = H(1) H(2) . . . H(k), where k = min(m,n).

       Each H(i) has the form

          H(i) = I - tau * v * v'

       where tau is a real scalar, and v is a real vector with
       v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
       and tau in TAU(i).

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] |
lwork1 | size of work array; should be optimized with Modelica_LinearSystems2.Math.Matrices.Internal.dgeqp3_workdim

### Outputs

Name | Description
--- | ---
Aout[size(A, 1), size(A, 2)] | the upper triangle of the array contains the upper trapezoidal matrix R; the elements below the diagonal, together with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors
tau[min(size(A, 1), size(A, 2))] | scalar factors of the elementary reflectors
info |
work[max(lwork1, 3*size(A, 2) + 1)] |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgesdd

Determine singular value decomposition

### Information

       Purpose
       =======

       DGESDD computes the singular value decomposition (SVD) of a real
       M-by-N matrix A, optionally computing the left and right singular
       vectors.  If singular vectors are desired, it uses a
       divide-and-conquer algorithm.

       The SVD is written

            A = U * SIGMA * transpose(V)

       where SIGMA is an M-by-N matrix which is zero except for its
       min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and
       V is an N-by-N orthogonal matrix.  The diagonal elements of SIGMA
       are the singular values of A; they are real and non-negative, and
       are returned in descending order.  The first min(m,n) columns of
       U and V are the left and right singular vectors of A.

       Note that the routine returns VT = V**T, not V.

       The divide and conquer algorithm makes very mild assumptions about
       floating point arithmetic. It will work on machines with a guard
       digit in add/subtract, or on those binary machines without guard
       digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
       Cray-2. It could conceivably fail on hexadecimal or decimal machines
       without guard digits, but we know of none.

       Arguments
       =========

       JOBZ    (input) CHARACTER*1
               Specifies options for computing all or part of the matrix U:
               = 'A':  all M columns of U and all N rows of V**T are
                       returned in the arrays U and VT;
               = 'S':  the first min(M,N) columns of U and the first
                       min(M,N) rows of V**T are returned in the arrays U
                       and VT;
               = 'O':  If M >= N, the first N columns of U are overwritten
                       on the array A and all rows of V**T are returned in
                       the array VT;
                       otherwise, all columns of U are returned in the
                       array U and the first M rows of V**T are overwritten
                       in the array VT;
               = 'N':  no columns of U or rows of V**T are computed.

       M       (input) INTEGER
               The number of rows of the input matrix A.  M >= 0.

       N       (input) INTEGER
               The number of columns of the input matrix A.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the M-by-N matrix A.
               On exit,
               if JOBZ = 'O',  A is overwritten with the first N columns
                               of U (the left singular vectors, stored
                               columnwise) if M >= N;
                               A is overwritten with the first M rows
                               of V**T (the right singular vectors, stored
                               rowwise) otherwise.
               if JOBZ .ne. 'O', the contents of A are destroyed.

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max(1,M).

       S       (output) DOUBLE PRECISION array, dimension (min(M,N))
               The singular values of A, sorted so that S(i) >= S(i+1).

       U       (output) DOUBLE PRECISION array, dimension (LDU,UCOL)
               UCOL = M if JOBZ = 'A' or JOBZ = 'O' and M < N;
               UCOL = min(M,N) if JOBZ = 'S'.
               If JOBZ = 'A' or JOBZ = 'O' and M < N, U contains the M-by-M
               orthogonal matrix U;
               if JOBZ = 'S', U contains the first min(M,N) columns of U
               (the left singular vectors, stored columnwise);
               if JOBZ = 'O' and M >= N, or JOBZ = 'N', U is not referenced.

       LDU     (input) INTEGER
               The leading dimension of the array U.  LDU >= 1; if
               JOBZ = 'S' or 'A' or JOBZ = 'O' and M < N, LDU >= M.

       VT      (output) DOUBLE PRECISION array, dimension (LDVT,N)
               If JOBZ = 'A' or JOBZ = 'O' and M >= N, VT contains the
               N-by-N orthogonal matrix V**T;
               if JOBZ = 'S', VT contains the first min(M,N) rows of
               V**T (the right singular vectors, stored rowwise);
               if JOBZ = 'O' and M < N, or JOBZ = 'N', VT is not referenced.

       LDVT    (input) INTEGER
               The leading dimension of the array VT.  LDVT >= 1; if
               JOBZ = 'A' or JOBZ = 'O' and M >= N, LDVT >= N;
               if JOBZ = 'S', LDVT >= min(M,N).

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK;

       LWORK   (input) INTEGER
               The dimension of the array WORK. LWORK >= 1.
               If JOBZ = 'N',
                 LWORK >= 3*min(M,N) + max(max(M,N),6*min(M,N)).
               If JOBZ = 'O',
                 LWORK >= 3*min(M,N)*min(M,N) +
                          max(max(M,N),5*min(M,N)*min(M,N)+4*min(M,N)).
               If JOBZ = 'S' or 'A'
                 LWORK >= 3*min(M,N)*min(M,N) +
                          max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)).
               For good performance, LWORK should generally be larger.
               If LWORK < 0 but other input arguments are legal, WORK(1)
               returns the optimal LWORK.

       IWORK   (workspace) INTEGER array, dimension (8*min(M,N))

       INFO    (output) INTEGER
               = 0:  successful exit.
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               > 0:  DBDSDC did not converge, updating process failed.

       Further Details
       ===============

       Based on contributions by
          Ming Gu and Huan Ren, Computer Science Division, University of
          California at Berkeley, USA

       =====================================================================

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, :] |

### Outputs

Name | Description
--- | ---
sigma[min(size(A, 1), size(A, 2))] |
U[size(A, 1), size(A, 1)] |
VT[size(A, 2), size(A, 2)] |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgesvd

Determine singular value decomposition

### Information

    Lapack documentation:
        Purpose
        =======
        DGESVD computes the singular value decomposition (SVD) of a real
        M-by-N matrix A, optionally computing the left and/or right singular

        vectors. The SVD is written
             A = U * SIGMA * transpose(V)
        where SIGMA is an M-by-N matrix which is zero except for its
        min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and
        V is an N-by-N orthogonal matrix.  The diagonal elements of SIGMA
        are the singular values of A; they are real and non-negative, and
        are returned in descending order.  The first min(m,n) columns of
        U and V are the left and right singular vectors of A.
        Note that the routine returns V**T, not V.
        Arguments
        =========
        JOBU    (input) CHARACTER*1
                Specifies options for computing all or part of the matrix U:

                = 'A':  all M columns of U are returned in array U:
                = 'S':  the first min(m,n) columns of U (the left singular
                        vectors) are returned in the array U;
                = 'O':  the first min(m,n) columns of U (the left singular
                        vectors) are overwritten on the array A;
                = 'N':  no columns of U (no left singular vectors) are
                        computed.
        JOBVT   (input) CHARACTER*1
                Specifies options for computing all or part of the matrix
                V**T:
                = 'A':  all N rows of V**T are returned in the array VT;
                = 'S':  the first min(m,n) rows of V**T (the right singular
                        vectors) are returned in the array VT;
                = 'O':  the first min(m,n) rows of V**T (the right singular
                        vectors) are overwritten on the array A;
                = 'N':  no rows of V**T (no right singular vectors) are
                        computed.
                JOBVT and JOBU cannot both be 'O'.
        M       (input) INTEGER
                The number of rows of the input matrix A.  M >= 0.
        N       (input) INTEGER
                The number of columns of the input matrix A.  N >= 0.
        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the M-by-N matrix A.
                On exit,
                if JOBU = 'O',  A is overwritten with the first min(m,n)
                                columns of U (the left singular vectors,
                                stored columnwise);
                if JOBVT = 'O', A is overwritten with the first min(m,n)
                                rows of V**T (the right singular vectors,
                                stored rowwise);
                if JOBU .ne. 'O' and JOBVT .ne. 'O', the contents of A
                                are destroyed.
        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,M).
        S       (output) DOUBLE PRECISION array, dimension (min(M,N))
                The singular values of A, sorted so that S(i) >= S(i+1).
        U       (output) DOUBLE PRECISION array, dimension (LDU,UCOL)
                (LDU,M) if JOBU = 'A' or (LDU,min(M,N)) if JOBU = 'S'.
                If JOBU = 'A', U contains the M-by-M orthogonal matrix U;
                if JOBU = 'S', U contains the first min(m,n) columns of U
                (the left singular vectors, stored columnwise);
                if JOBU = 'N' or 'O', U is not referenced.
        LDU     (input) INTEGER
                The leading dimension of the array U.  LDU >= 1; if
                JOBU = 'S' or 'A', LDU >= M.
        VT      (output) DOUBLE PRECISION array, dimension (LDVT,N)
                If JOBVT = 'A', VT contains the N-by-N orthogonal matrix
                V**T;
                if JOBVT = 'S', VT contains the first min(m,n) rows of
                V**T (the right singular vectors, stored rowwise);
                if JOBVT = 'N' or 'O', VT is not referenced.
        LDVT    (input) INTEGER
                The leading dimension of the array VT.  LDVT >= 1; if
                JOBVT = 'A', LDVT >= N; if JOBVT = 'S', LDVT >= min(M,N).
        WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)

                On exit, if INFO = 0, WORK(1) returns the optimal LWORK;
                if INFO > 0, WORK(2:MIN(M,N)) contains the unconverged
                superdiagonal elements of an upper bidiagonal matrix B
                whose diagonal is in S (not necessarily sorted). B
                satisfies A = U * B * VT, so it has the same singular values

                as A, and singular vectors related by U and VT.
        LWORK   (input) INTEGER
                The dimension of the array WORK. LWORK >= 1.
                LWORK >= MAX(3*MIN(M,N)+MAX(M,N),5*MIN(M,N)-4).
                For good performance, LWORK should generally be larger.
        INFO    (output) INTEGER
                = 0:  successful exit.
                < 0:  if INFO = -i, the i-th argument had an illegal value.
                > 0:  if DBDSQR did not converge, INFO specifies how many
                      superdiagonals of an intermediate bidiagonal form B
                      did not converge to zero. See the description of WORK
                      above for details.

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, :] |

### Outputs

Name | Description
--- | ---
sigma[min(size(A, 1), size(A, 2))] |
U[size(A, 1), size(A, 1)] |
VT[size(A, 2), size(A, 2)] |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgesvx

Solve real system of linear equations op(A)*X=B, op(A) is A or A' according to the boolean input transposed

### Information

    Lapack documentation:
        Purpose
        =======
        DGESV computes the solution to a real system of linear equations
           A * X = B,
        where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
        The LU decomposition with partial pivoting and row interchanges is
        used to factor A as
           A = P * L * U,
        where P is a permutation matrix, L is unit lower triangular, and U is

        upper triangular.  The factored form of A is then used to solve the
        system of equations A * X = B.
        Arguments
        =========
        N       (input) INTEGER
                The number of linear equations, i.e., the order of the
                matrix A.  N >= 0.
        NRHS    (input) INTEGER
                The number of right hand sides, i.e., the number of columns
                of the matrix B.  NRHS >= 0.
        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the N-by-N coefficient matrix A.
                On exit, the factors L and U from the factorization
                A = P*L*U; the unit diagonal elements of L are not stored.
        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).
        IPIV    (output) INTEGER array, dimension (N)
                The pivot indices that define the permutation matrix P;
                row i of the matrix was interchanged with row IPIV(i).
        B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
                On entry, the N-by-NRHS matrix of right hand side matrix B.
                On exit, if INFO = 0, the N-by-NRHS solution matrix X.
        LDB     (input) INTEGER
                The leading dimension of the array B.  LDB >= max(1,N).
        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value
                > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization

                      has been completed, but the factor U is exactly
                      singular, so the solution could not be computed.

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |
B[size(A, 1), :] |
transposed |

### Outputs

Name | Description
--- | ---
X[size(A, 1), size(B, 2)] |
info |
rcond |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgetrs

Solves a system of linear equations with the LU decomposition from dgetrf(..)

### Information

    Purpose
    =======
    DGETRS solves a system of linear equations
       A * X = B  or  A' * X = B
    with a general N-by-N matrix A using the LU factorization computed
    by DGETRF.
    Arguments
    =========
    TRANS   (input) CHARACTER*1
            Specifies the form of the system of equations:
            = 'N':  A * X = B  (No transpose)
            = 'T':  A'* X = B  (Transpose)
            = 'C':  A'* X = B  (Conjugate transpose = Transpose)
    N       (input) INTEGER
            The order of the matrix A.  N >= 0.
    NRHS    (input) INTEGER
            The number of right hand sides, i.e., the number of columns
            of the matrix B.  NRHS >= 0.
    A       (input) DOUBLE PRECISION array, dimension (LDA,N)
            The factors L and U from the factorization A = P*L*U
            as computed by DGETRF.
    LDA     (input) INTEGER
            The leading dimension of the array A.  LDA >= max(1,N).
    IPIV    (input) INTEGER array, dimension (N)
            The pivot indices from DGETRF; for 1<=i<=N, row i of the
            matrix was interchanged with row IPIV(i).
    B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
            On entry, the right hand side matrix B.
            On exit, the solution matrix X.
    LDB     (input) INTEGER
            The leading dimension of the array B.  LDB >= max(1,N).
    INFO    (output) INTEGER
            = 0:  successful exit
            < 0:  if INFO = -i, the i-th argument had an illegal value

### Inputs

Name | Description
--- | ---
LU[:, size(LU, 1)] | LU factorization of dgetrf of a square matrix
pivots[size(LU, 1)] | Pivot vector of dgetrf
B[size(LU, 1), :] | Right hand side matrix B

### Outputs

Name | Description
--- | ---
X[size(B, 1), size(B, 2)] | Solution matrix X

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dggev

Compute generalized eigenvalues for a (A,B) system

### Information

       Purpose
       =======

       DGGEV computes for a pair of N-by-N real nonsymmetric matrices (A,B)
       the generalized eigenvalues, and optionally, the left and/or right
       generalized eigenvectors.

       A generalized eigenvalue for a pair of matrices (A,B) is a scalar
       lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
       singular. It is usually represented as the pair (alpha,beta), as
       there is a reasonable interpretation for beta=0, and even for both
       being zero.

       The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
       of (A,B) satisfies

                        A * v(j) = lambda(j) * B * v(j).

       The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
       of (A,B) satisfies

                        u(j)**H * A  = lambda(j) * u(j)**H * B .

       where u(j)**H is the conjugate-transpose of u(j).

       Arguments
       =========

       JOBVL   (input) CHARACTER*1
               = 'N':  do not compute the left generalized eigenvectors;
               = 'V':  compute the left generalized eigenvectors.

       JOBVR   (input) CHARACTER*1
               = 'N':  do not compute the right generalized eigenvectors;
               = 'V':  compute the right generalized eigenvectors.

       N       (input) INTEGER
               The order of the matrices A, B, VL, and VR.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA, N)
               On entry, the matrix A in the pair (A,B).
               On exit, A has been overwritten.

       LDA     (input) INTEGER
               The leading dimension of A.  LDA >= max(1,N).

       B       (input/output) DOUBLE PRECISION array, dimension (LDB, N)
               On entry, the matrix B in the pair (A,B).
               On exit, B has been overwritten.

       LDB     (input) INTEGER
               The leading dimension of B.  LDB >= max(1,N).

       ALPHAR  (output) DOUBLE PRECISION array, dimension (N)
       ALPHAI  (output) DOUBLE PRECISION array, dimension (N)
       BETA    (output) DOUBLE PRECISION array, dimension (N)
               On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
               be the generalized eigenvalues.  If ALPHAI(j) is zero, then
               the j-th eigenvalue is real; if positive, then the j-th and
               (j+1)-st eigenvalues are a complex conjugate pair, with
               ALPHAI(j+1) negative.

               Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
               may easily over- or underflow, and BETA(j) may even be zero.
               Thus, the user should avoid naively computing the ratio
               alpha/beta.  However, ALPHAR and ALPHAI will be always less
               than and usually comparable with norm(A) in magnitude, and
               BETA always less than and usually comparable with norm(B).

       VL      (output) DOUBLE PRECISION array, dimension (LDVL,N)
               If JOBVL = 'V', the left eigenvectors u(j) are stored one
               after another in the columns of VL, in the same order as
               their eigenvalues. If the j-th eigenvalue is real, then
               u(j) = VL(:,j), the j-th column of VL. If the j-th and
               (j+1)-th eigenvalues form a complex conjugate pair, then
               u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1).
               Each eigenvector will be scaled so the largest component have
               abs(real part)+abs(imag. part)=1.
               Not referenced if JOBVL = 'N'.

       LDVL    (input) INTEGER
               The leading dimension of the matrix VL. LDVL >= 1, and
               if JOBVL = 'V', LDVL >= N.

       VR      (output) DOUBLE PRECISION array, dimension (LDVR,N)
               If JOBVR = 'V', the right eigenvectors v(j) are stored one
               after another in the columns of VR, in the same order as
               their eigenvalues. If the j-th eigenvalue is real, then
               v(j) = VR(:,j), the j-th column of VR. If the j-th and
               (j+1)-th eigenvalues form a complex conjugate pair, then
               v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1).
               Each eigenvector will be scaled so the largest component have
               abs(real part)+abs(imag. part)=1.
               Not referenced if JOBVR = 'N'.

       LDVR    (input) INTEGER
               The leading dimension of the matrix VR. LDVR >= 1, and
               if JOBVR = 'V', LDVR >= N.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,8*N).
               For good performance, LWORK must generally be larger.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               = 1,...,N:
                     The QZ iteration failed.  No eigenvectors have been
                     calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
                     should be correct for j=INFO+1,...,N.
               > N:  =N+1: other than QZ iteration failed in DHGEQZ.
                     =N+2: error return from DTGEVC.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |
B[size(A, 1), size(A, 1)] |
nA |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag)/beta)
alphaImag[size(A, 1)] | Imaginary part of alpha
beta[size(A, 1)] | Denominator of eigenvalue
lEigenVectors[size(A, 1), size(A, 1)] | left eigenvectors of matrix A
rEigenVectors[size(A, 1), size(A, 1)] | right eigenvectors of matrix A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dggevx

Compute generalized eigenvalues for a (A,B) system, using lapack routine dggevx

### Information

    /*  Purpose
    /*  =======

       DGGEVX computes for a pair of N-by-N real nonsymmetric matrices (A,B)
       the generalized eigenvalues, and optionally, the left and/or right
       generalized eigenvectors.

       Optionally also, it computes a balancing transformation to improve
       the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
       LSCALE, RSCALE, ABNRM, and BBNRM), reciprocal condition numbers for
       the eigenvalues (RCONDE), and reciprocal condition numbers for the
       right eigenvectors (RCONDV).

       A generalized eigenvalue for a pair of matrices (A,B) is a scalar
       lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
       singular. It is usually represented as the pair (alpha,beta), as
       there is a reasonable interpretation for beta=0, and even for both
       being zero.

       The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
       of (A,B) satisfies

                        A * v(j) = lambda(j) * B * v(j) .

       The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
       of (A,B) satisfies

                        u(j)**H * A  = lambda(j) * u(j)**H * B.

       where u(j)**H is the conjugate-transpose of u(j).

       Arguments
       =========

       BALANC  (input) CHARACTER*1
               Specifies the balance option to be performed.
               = 'N':  do not diagonally scale or permute;
               = 'P':  permute only;
               = 'S':  scale only;
               = 'B':  both permute and scale.
               Computed reciprocal condition numbers will be for the
               matrices after permuting and/or balancing. Permuting does
               not change condition numbers (in exact arithmetic), but
               balancing does.

       JOBVL   (input) CHARACTER*1
               = 'N':  do not compute the left generalized eigenvectors;
               = 'V':  compute the left generalized eigenvectors.

       JOBVR   (input) CHARACTER*1
               = 'N':  do not compute the right generalized eigenvectors;
               = 'V':  compute the right generalized eigenvectors.

       SENSE   (input) CHARACTER*1
               Determines which reciprocal condition numbers are computed.
               = 'N': none are computed;
               = 'E': computed for eigenvalues only;
               = 'V': computed for eigenvectors only;
               = 'B': computed for eigenvalues and eigenvectors.

       N       (input) INTEGER
               The order of the matrices A, B, VL, and VR.  N >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA, N)
               On entry, the matrix A in the pair (A,B).
               On exit, A has been overwritten. If JOBVL='V' or JOBVR='V'
               or both, then A contains the first part of the real Schur
               form of the "balanced" versions of the input A and B.

       LDA     (input) INTEGER
               The leading dimension of A.  LDA >= max(1,N).

       B       (input/output) DOUBLE PRECISION array, dimension (LDB, N)
               On entry, the matrix B in the pair (A,B).
               On exit, B has been overwritten. If JOBVL='V' or JOBVR='V'
               or both, then B contains the second part of the real Schur
               form of the "balanced" versions of the input A and B.

       LDB     (input) INTEGER
               The leading dimension of B.  LDB >= max(1,N).

       ALPHAR  (output) DOUBLE PRECISION array, dimension (N)
       ALPHAI  (output) DOUBLE PRECISION array, dimension (N)
       BETA    (output) DOUBLE PRECISION array, dimension (N)
               On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
               be the generalized eigenvalues.  If ALPHAI(j) is zero, then
               the j-th eigenvalue is real; if positive, then the j-th and
               (j+1)-st eigenvalues are a complex conjugate pair, with
               ALPHAI(j+1) negative.

               Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
               may easily over- or underflow, and BETA(j) may even be zero.
               Thus, the user should avoid naively computing the ratio
               ALPHA/BETA. However, ALPHAR and ALPHAI will be always less
               than and usually comparable with norm(A) in magnitude, and
               BETA always less than and usually comparable with norm(B).

       VL      (output) DOUBLE PRECISION array, dimension (LDVL,N)
               If JOBVL = 'V', the left eigenvectors u(j) are stored one
               after another in the columns of VL, in the same order as
               their eigenvalues. If the j-th eigenvalue is real, then
               u(j) = VL(:,j), the j-th column of VL. If the j-th and
               (j+1)-th eigenvalues form a complex conjugate pair, then
               u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1).
               Each eigenvector will be scaled so the largest component have
               abs(real part) + abs(imag. part) = 1.
               Not referenced if JOBVL = 'N'.

       LDVL    (input) INTEGER
               The leading dimension of the matrix VL. LDVL >= 1, and
               if JOBVL = 'V', LDVL >= N.

       VR      (output) DOUBLE PRECISION array, dimension (LDVR,N)
               If JOBVR = 'V', the right eigenvectors v(j) are stored one
               after another in the columns of VR, in the same order as
               their eigenvalues. If the j-th eigenvalue is real, then
               v(j) = VR(:,j), the j-th column of VR. If the j-th and
               (j+1)-th eigenvalues form a complex conjugate pair, then
               v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1).
               Each eigenvector will be scaled so the largest component have
               abs(real part) + abs(imag. part) = 1.
               Not referenced if JOBVR = 'N'.

       LDVR    (input) INTEGER
               The leading dimension of the matrix VR. LDVR >= 1, and
               if JOBVR = 'V', LDVR >= N.

       ILO,IHI (output) INTEGER
               ILO and IHI are integer values such that on exit
               A(i,j) = 0 and B(i,j) = 0 if i > j and
               j = 1,...,ILO-1 or i = IHI+1,...,N.
               If BALANC = 'N' or 'S', ILO = 1 and IHI = N.

       LSCALE  (output) DOUBLE PRECISION array, dimension (N)
               Details of the permutations and scaling factors applied
               to the left side of A and B.  If PL(j) is the index of the
               row interchanged with row j, and DL(j) is the scaling
               factor applied to row j, then
                 LSCALE(j) = PL(j)  for j = 1,...,ILO-1
                           = DL(j)  for j = ILO,...,IHI
                           = PL(j)  for j = IHI+1,...,N.
               The order in which the interchanges are made is N to IHI+1,
               then 1 to ILO-1.

       RSCALE  (output) DOUBLE PRECISION array, dimension (N)
               Details of the permutations and scaling factors applied
               to the right side of A and B.  If PR(j) is the index of the
               column interchanged with column j, and DR(j) is the scaling
               factor applied to column j, then
                 RSCALE(j) = PR(j)  for j = 1,...,ILO-1
                           = DR(j)  for j = ILO,...,IHI
                           = PR(j)  for j = IHI+1,...,N
               The order in which the interchanges are made is N to IHI+1,
               then 1 to ILO-1.

       ABNRM   (output) DOUBLE PRECISION
               The one-norm of the balanced matrix A.

       BBNRM   (output) DOUBLE PRECISION
               The one-norm of the balanced matrix B.

       RCONDE  (output) DOUBLE PRECISION array, dimension (N)
               If SENSE = 'E' or 'B', the reciprocal condition numbers of
               the selected eigenvalues, stored in consecutive elements of
               the array. For a complex conjugate pair of eigenvalues two
               consecutive elements of RCONDE are set to the same value.
               Thus RCONDE(j), RCONDV(j), and the j-th columns of VL and VR
               all correspond to the same eigenpair (but not in general the
               j-th eigenpair, unless all eigenpairs are selected).
               If SENSE = 'V', RCONDE is not referenced.

       RCONDV  (output) DOUBLE PRECISION array, dimension (N)
               If SENSE = 'V' or 'B', the estimated reciprocal condition
               numbers of the selected eigenvectors, stored in consecutive
               elements of the array. For a complex eigenvector two
               consecutive elements of RCONDV are set to the same value. If
               the eigenvalues cannot be reordered to compute RCONDV(j),
               RCONDV(j) is set to 0; this can only occur when the true
               value would be very small anyway.
               If SENSE = 'E', RCONDV is not referenced.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK. LWORK >= max(1,6*N).
               If SENSE = 'E', LWORK >= 12*N.
               If SENSE = 'V' or 'B', LWORK >= 2*N*N+12*N+16.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       IWORK   (workspace) INTEGER array, dimension (N+6)
               If SENSE = 'E', IWORK is not referenced.

       BWORK   (workspace) LOGICAL array, dimension (N)
               If SENSE = 'N', BWORK is not referenced.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value.
               = 1,...,N:
                     The QZ iteration failed.  No eigenvectors have been
                     calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
                     should be correct for j=INFO+1,...,N.
               > N:  =N+1: other than QZ iteration failed in DHGEQZ.
                     =N+2: error return from DTGEVC.

       Further Details
       ===============

       Balancing a matrix pair (A,B) includes, first, permuting rows and
       columns to isolate eigenvalues, second, applying diagonal similarity
       transformation to the rows and columns to make the rows and columns
       as close in norm as possible. The computed reciprocal condition
       numbers correspond to the balanced matrix. Permuting rows and columns
       will not change the condition numbers (in exact arithmetic) but
       diagonal scaling will.  For further explanation of balancing, see
       section 4.11.1.2 of LAPACK Users' Guide.

       An approximate error bound on the chordal distance between the i-th
       computed generalized eigenvalue w and the corresponding exact
       eigenvalue lambda is

            chord(w, lambda) <= EPS * norm(ABNRM, BBNRM) / RCONDE(I)

       An approximate error bound for the angle between the i-th computed
       eigenvector VL(i) or VR(i) is given by

            EPS * norm(ABNRM, BBNRM) / DIF(i).

       For further explanation of the reciprocal condition numbers RCONDE
       and RCONDV, see section 4.11 of LAPACK User's Guide.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |
B[size(A, 1), size(A, 1)] |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag)/beta)
alphaImag[size(A, 1)] | Imaginary part of alpha
beta[size(A, 1)] | Denominator of eigenvalue
lEigenVectors[size(A, 1), size(A, 1)] | left eigenvectors of matrix A
rEigenVectors[size(A, 1), size(A, 1)] | right eigenvectors of matrix A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dhgeqz

Compute generalized eigenvalues for a (A,B) system

### Information

         Purpose
       =======

       DHGEQZ implements a single-/double-shift version of the QZ method for
       finding the generalized eigenvalues

       w(j)=(ALPHAR(j) + i*ALPHAI(j))/BETAR(j)   of the equation

            det( A - w(i) B ) = 0

       In addition, the pair A,B may be reduced to generalized Schur form:
       B is upper triangular, and A is block upper triangular, where the
       diagonal blocks are either 1-by-1 or 2-by-2, the 2-by-2 blocks having
       complex generalized eigenvalues (see the description of the argument
       JOB.)

       If JOB='S', then the pair (A,B) is simultaneously reduced to Schur
       form by applying one orthogonal tranformation (usually called Q) on
       the left and another (usually called Z) on the right.  The 2-by-2
       upper-triangular diagonal blocks of B corresponding to 2-by-2 blocks
       of A will be reduced to positive diagonal matrices.  (I.e.,
       if A(j+1,j) is non-zero, then B(j+1,j)=B(j,j+1)=0 and B(j,j) and
       B(j+1,j+1) will be positive.)

       If JOB='E', then at each iteration, the same transformations
       are computed, but they are only applied to those parts of A and B
       which are needed to compute ALPHAR, ALPHAI, and BETAR.

       If JOB='S' and COMPQ and COMPZ are 'V' or 'I', then the orthogonal
       transformations used to reduce (A,B) are accumulated into the arrays
       Q and Z s.t.:

            Q(in) A(in) Z(in)* = Q(out) A(out) Z(out)*
            Q(in) B(in) Z(in)* = Q(out) B(out) Z(out)*

       Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
            Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
            pp. 241--256.

       Arguments
       =========

       JOB     (input) CHARACTER*1
               = 'E': compute only ALPHAR, ALPHAI, and BETA.  A and B will
                      not necessarily be put into generalized Schur form.
               = 'S': put A and B into generalized Schur form, as well
                      as computing ALPHAR, ALPHAI, and BETA.

       COMPQ   (input) CHARACTER*1
               = 'N': do not modify Q.
               = 'V': multiply the array Q on the right by the transpose of
                      the orthogonal tranformation that is applied to the
                      left side of A and B to reduce them to Schur form.
               = 'I': like COMPQ='V', except that Q will be initialized to
                      the identity first.

       COMPZ   (input) CHARACTER*1
               = 'N': do not modify Z.
               = 'V': multiply the array Z on the right by the orthogonal
                      tranformation that is applied to the right side of
                      A and B to reduce them to Schur form.
               = 'I': like COMPZ='V', except that Z will be initialized to
                      the identity first.

       N       (input) INTEGER
               The order of the matrices A, B, Q, and Z.  N >= 0.

       ILO     (input) INTEGER
       IHI     (input) INTEGER
               It is assumed that A is already upper triangular in rows and
               columns 1:ILO-1 and IHI+1:N.
               1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA, N)
               On entry, the N-by-N upper Hessenberg matrix A.  Elements
               below the subdiagonal must be zero.
               If JOB='S', then on exit A and B will have been
                  simultaneously reduced to generalized Schur form.
               If JOB='E', then on exit A will have been destroyed.
                  The diagonal blocks will be correct, but the off-diagonal
                  portion will be meaningless.

       LDA     (input) INTEGER
               The leading dimension of the array A.  LDA >= max( 1, N ).

       B       (input/output) DOUBLE PRECISION array, dimension (LDB, N)
               On entry, the N-by-N upper triangular matrix B.  Elements
               below the diagonal must be zero.  2-by-2 blocks in B
               corresponding to 2-by-2 blocks in A will be reduced to
               positive diagonal form.  (I.e., if A(j+1,j) is non-zero,
               then B(j+1,j)=B(j,j+1)=0 and B(j,j) and B(j+1,j+1) will be
               positive.)
               If JOB='S', then on exit A and B will have been
                  simultaneously reduced to Schur form.
               If JOB='E', then on exit B will have been destroyed.
                  Elements corresponding to diagonal blocks of A will be
                  correct, but the off-diagonal portion will be meaningless.

       LDB     (input) INTEGER
               The leading dimension of the array B.  LDB >= max( 1, N ).

       ALPHAR  (output) DOUBLE PRECISION array, dimension (N)
               ALPHAR(1:N) will be set to real parts of the diagonal
               elements of A that would result from reducing A and B to
               Schur form and then further reducing them both to triangular
               form using unitary transformations s.t. the diagonal of B
               was non-negative real.  Thus, if A(j,j) is in a 1-by-1 block
               (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=A(j,j).
               Note that the (real or complex) values
               (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
               generalized eigenvalues of the matrix pencil A - wB.

       ALPHAI  (output) DOUBLE PRECISION array, dimension (N)
               ALPHAI(1:N) will be set to imaginary parts of the diagonal
               elements of A that would result from reducing A and B to
               Schur form and then further reducing them both to triangular
               form using unitary transformations s.t. the diagonal of B
               was non-negative real.  Thus, if A(j,j) is in a 1-by-1 block
               (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=0.
               Note that the (real or complex) values
               (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
               generalized eigenvalues of the matrix pencil A - wB.

       BETA    (output) DOUBLE PRECISION array, dimension (N)
               BETA(1:N) will be set to the (real) diagonal elements of B
               that would result from reducing A and B to Schur form and
               then further reducing them both to triangular form using
               unitary transformations s.t. the diagonal of B was
               non-negative real.  Thus, if A(j,j) is in a 1-by-1 block
               (i.e., A(j+1,j)=A(j,j+1)=0), then BETA(j)=B(j,j).
               Note that the (real or complex) values
               (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
               generalized eigenvalues of the matrix pencil A - wB.
               (Note that BETA(1:N) will always be non-negative, and no
               BETAI is necessary.)

       Q       (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
               If COMPQ='N', then Q will not be referenced.
               If COMPQ='V' or 'I', then the transpose of the orthogonal
                  transformations which are applied to A and B on the left
                  will be applied to the array Q on the right.

       LDQ     (input) INTEGER
               The leading dimension of the array Q.  LDQ >= 1.
               If COMPQ='V' or 'I', then LDQ >= N.

       Z       (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
               If COMPZ='N', then Z will not be referenced.
               If COMPZ='V' or 'I', then the orthogonal transformations
                  which are applied to A and B on the right will be applied
                  to the array Z on the right.

       LDZ     (input) INTEGER
               The leading dimension of the array Z.  LDZ >= 1.
               If COMPZ='V' or 'I', then LDZ >= N.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,N).

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0: successful exit
               < 0: if INFO = -i, the i-th argument had an illegal value
               = 1,...,N: the QZ iteration did not converge.  (A,B) is not
                          in Schur form, but ALPHAR(i), ALPHAI(i), and
                          BETA(i), i=INFO+1,...,N should be correct.
               = N+1,...,2*N: the shift calculation failed.  (A,B) is not
                          in Schur form, but ALPHAR(i), ALPHAI(i), and
                          BETA(i), i=INFO-N+1,...,N should be correct.
               > 2*N:     various "impossible" errors.

       Further Details
       ===============

       Iteration counters:

       JITER  -- counts iterations.
       IITER  -- counts iterations run since ILAST was last
                 changed.  This is therefore reset only when a 1-by-1 or
                 2-by-2 block deflates off the bottom.

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] |
B[size(A, 1), size(A, 1)] |

### Outputs

Name | Description
--- | ---
alphaReal[size(A, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag)/beta)
alphaImag[size(A, 1)] | Imaginary part of alpha
beta[size(A, 1)] | Denominator of eigenvalue
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dhseqr

Compute eingenvalues of a matrix A using lapack routine DHSEQR for Hessenberg form matrix

### Information

        DHSEQR computes the eigenvalues of a real upper Hessenberg matrix H
       and, optionally, the matrices T and Z from the Schur decomposition
       H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur
       form), and Z is the orthogonal matrix of Schur vectors.

       Optionally Z may be postmultiplied into an input orthogonal matrix Q,
       so that this routine can give the Schur factorization of a matrix A
       which has been reduced to the Hessenberg form H by the orthogonal
       matrix Q:  A = Q*H*Q**T = (QZ)*T*(QZ)**T.

       Arguments
       =========

       JOB     (input) CHARACTER*1
               = 'E':  compute eigenvalues only;
               = 'S':  compute eigenvalues and the Schur form T.

       COMPZ   (input) CHARACTER*1
               = 'N':  no Schur vectors are computed;
               = 'I':  Z is initialized to the unit matrix and the matrix Z
                       of Schur vectors of H is returned;
               = 'V':  Z must contain an orthogonal matrix Q on entry, and
                       the product Q*Z is returned.

       N       (input) INTEGER
               The order of the matrix H.  N >= 0.

       ILO     (input) INTEGER
       IHI     (input) INTEGER
               It is assumed that H is already upper triangular in rows
               and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally
               set by a previous call to DGEBAL, and then passed to SGEHRD
               when the matrix output by DGEBAL is reduced to Hessenberg
               form. Otherwise ILO and IHI should be set to 1 and N
               respectively.
               1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.

       H       (input/output) DOUBLE PRECISION array, dimension (LDH,N)
               On entry, the upper Hessenberg matrix H.
               On exit, if JOB = 'S', H contains the upper quasi-triangular
               matrix T from the Schur decomposition (the Schur form);
               2-by-2 diagonal blocks (corresponding to complex conjugate
               pairs of eigenvalues) are returned in standard form, with
               H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If JOB = 'E',
               the contents of H are unspecified on exit.

       LDH     (input) INTEGER
               The leading dimension of the array H. LDH >= max(1,N).

       WR      (output) DOUBLE PRECISION array, dimension (N)
       WI      (output) DOUBLE PRECISION array, dimension (N)
               The real and imaginary parts, respectively, of the computed
               eigenvalues. If two eigenvalues are computed as a complex
               conjugate pair, they are stored in consecutive elements of
               WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and
               WI(i+1) < 0. If JOB = 'S', the eigenvalues are stored in the
               same order as on the diagonal of the Schur form returned in
               H, with WR(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2
               diagonal block, WI(i) = sqrt(H(i+1,i)*H(i,i+1)) and
               WI(i+1) = -WI(i).

       Z       (input/output) DOUBLE PRECISION array, dimension (LDZ,N)
               If COMPZ = 'N': Z is not referenced.
               If COMPZ = 'I': on entry, Z need not be set, and on exit, Z
               contains the orthogonal matrix Z of the Schur vectors of H.
               If COMPZ = 'V': on entry Z must contain an N-by-N matrix Q,
               which is assumed to be equal to the unit matrix except for
               the submatrix Z(ILO:IHI,ILO:IHI); on exit Z contains Q*Z.
               Normally Q is the orthogonal matrix generated by DORGHR after
               the call to DGEHRD which formed the Hessenberg matrix H.

       LDZ     (input) INTEGER
               The leading dimension of the array Z.
               LDZ >= max(1,N) if COMPZ = 'I' or 'V'; LDZ >= 1 otherwise.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.  LWORK >= max(1,N).

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value
               > 0:  if INFO = i, DHSEQR failed to compute all of the
                     eigenvalues in a total of 30*(IHI-ILO+1) iterations;
                     elements 1:ilo-1 and i+1:n of WR and WI contain those
                     eigenvalues which have been successfully computed.

       =====================================================================

### Inputs

Name | Description
--- | ---
H[:, size(H, 1)] |
lwork |
eigenValuesOnly |
compz |
Z[:, :] |

### Outputs

Name | Description
--- | ---
alphaReal[size(H, 1)] | Real part of alpha (eigenvalue=(alphaReal+i*alphaImag))
alphaImag[size(H, 1)] | Imaginary part of alpha (eigenvalue=(alphaReal+i*alphaImag))
info |
Ho[:, :] |
Zo[:, :] |
work[max({lwork,size(H, 1),1})] |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dlange

Norm of a matrix

### Information

Purpose ======= DLANGE returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real matrix A. Description =========== DLANGE returns the value DLANGE = ( max(abs(A(i,j))), NORM = 'M' or 'm' ( ( norm1(A), NORM = '1', 'O' or 'o' ( ( normI(A), NORM = 'I' or 'i' ( ( normF(A), NORM = 'F', 'f', 'E' or 'e' where norm1 denotes the one norm of a matrix (maximum column sum), normI denotes the infinity norm of a matrix (maximum row sum) and normF denotes the Frobenius norm of a matrix (square root of sum of squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. Arguments ========= NORM (input) CHARACTER*1 Specifies the value to be returned in DLANGE as described above. M (input) INTEGER The number of rows of the matrix A. M >= 0. When M = 0, DLANGE is set to zero. N (input) INTEGER The number of columns of the matrix A. N >= 0. When N = 0, DLANGE is set to zero. A (input) DOUBLE PRECISION array, dimension (LDA,N) The m by n matrix A. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(M,1). WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)), where LWORK >= M when NORM = 'I'; otherwise, WORK is not referenced. =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] | Real matrix A
norm | specifies the norm, i.e. 1, I, F, M

### Outputs

Name | Description
--- | ---
anorm | norm of A

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dlansy

Norm of a symmetric matrix

### Information

Purpose ======= DLANSY returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix A. Description =========== DLANSY returns the value DLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm' ( ( norm1(A), NORM = '1', 'O' or 'o' ( ( normI(A), NORM = 'I' or 'i' ( ( normF(A), NORM = 'F', 'f', 'E' or 'e' where norm1 denotes the one norm of a matrix (maximum column sum), normI denotes the infinity norm of a matrix (maximum row sum) and normF denotes the Frobenius norm of a matrix (square root of sum of squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. Arguments ========= NORM (input) CHARACTER*1 Specifies the value to be returned in DLANSY as described above. UPLO (input) CHARACTER*1 Specifies whether the upper or lower triangular part of the symmetric matrix A is to be referenced. = 'U': Upper triangular part of A is referenced = 'L': Lower triangular part of A is referenced N (input) INTEGER The order of the matrix A. N >= 0. When N = 0, DLANSY is set to zero. A (input) DOUBLE PRECISION array, dimension (LDA,N) The symmetric matrix A. If UPLO = 'U', the leading n by n upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading n by n lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(N,1). WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)), where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, WORK is not referenced. =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] | Real symmetric matrix A
norm | Specifies the norm, i.e. 1, I, F, M
upper | Specifies whether the upper or lower triangular part of A is referenced

### Outputs

Name | Description
--- | ---
anorm | Norm of A

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dorghr

generates a real orthogonal matrix Q which is defined as the product of IHI-ILO elementary reflectors of order N, as returned by DGEHRD

### Information

        Purpose
        =======

        DORGHR generates a real orthogonal matrix Q which is defined as the
        product of IHI-ILO elementary reflectors of order N, as returned by
        DGEHRD:

        Q = H(ilo) H(ilo+1) . . . H(ihi-1).

        Arguments
        =========

        N       (input) INTEGER
                The order of the matrix Q. N >= 0.

        ILO     (input) INTEGER
        IHI     (input) INTEGER
                ILO and IHI must have the same values as in the previous call
                of DGEHRD. Q is equal to the unit matrix except in the
                submatrix Q(ilo+1:ihi,ilo+1:ihi).
                1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the vectors which define the elementary reflectors,
                as returned by DGEHRD.
                On exit, the N-by-N orthogonal matrix Q.

        LDA     (input) INTEGER
                The leading dimension of the array A. LDA >= max(1,N).

        TAU     (input) DOUBLE PRECISION array, dimension (N-1)
                TAU(i) must contain the scalar factor of the elementary
                reflector H(i), as returned by DGEHRD.

        WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
                On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

        LWORK   (input) INTEGER
                The dimension of the array WORK. LWORK >= IHI-ILO.
                For optimum performance LWORK >= (IHI-ILO)*NB, where NB is
                the optimal blocksize.

                If LWORK = -1, then a workspace query is assumed; the routine
                only calculates the optimal size of the WORK array, returns
                this value as the first entry of the WORK array, and no error
                message related to LWORK is issued by XERBLA.

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value

        =====================================================================

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] | Square matrix A
ilo | lowest index where the original matrix had been Hessenbergform - ilo must have the same value as in the previous call of DGEHRD
ihi | highest index where the original matrix had been Hessenbergform - ihi must have the same value as in the previous call of DGEHRD
tau[max(0, size(A, 1) - 1)] | scalar factors of the elementary reflectors

### Outputs

Name | Description
--- | ---
Aout[size(A, 1), size(A, 2)] | Orthogonal matrix as a result of elementary reflectors
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dorgqr

Generate a real orthogonal matrix Q which is defined as the product of elementary reflectors, as returned by DGEQRF

### Information

       Purpose
       =======

       DORGQR generates an M-by-N real matrix Q with orthonormal columns,
       which is defined as the first N columns of a product of K elementary
       reflectors of order M

             Q  =  H(1) H(2) . . . H(k)

       as returned by DGEQRF.

       Arguments
       =========

       M       (input) INTEGER
               The number of rows of the matrix Q. M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix Q. M >= N >= 0.

       K       (input) INTEGER
               The number of elementary reflectors whose product defines the
               matrix Q. N >= K >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the i-th column must contain the vector which
               defines the elementary reflector H(i), for i = 1,2,...,k, as
               returned by DGEQRF in the first k columns of its array
               argument A.
               On exit, the M-by-N matrix Q.

       LDA     (input) INTEGER
               The first dimension of the array A. LDA >= max(1,M).

       TAU     (input) DOUBLE PRECISION array, dimension (K)
               TAU(i) must contain the scalar factor of the elementary
               reflector H(i), as returned by DGEQRF.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK. LWORK >= max(1,N).
               For optimum performance LWORK >= N*NB, where NB is the
               optimal blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument has an illegal value

       =====================================================================

### Inputs

Name | Description
--- | ---
Q[:, :] | Orthogonal matrix of elementary reflectors
tau[:] | Scalar factors of the elementary reflectors

### Outputs

Name | Description
--- | ---
Qout[size(Q, 1), size(Q, 2)] |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dorgqr_x

Generates a real orthogonal matrix Q which is defined as the product of elementary reflectors, as returned by DGEQRF

### Information

       Purpose
       =======

       DORGQR generates an M-by-N real matrix Q with orthonormal columns,
       which is defined as the first N columns of a product of K elementary
       reflectors of order M

             Q  =  H(1) H(2) . . . H(k)

       as returned by DGEQRF.

       Arguments
       =========

       M       (input) INTEGER
               The number of rows of the matrix Q. M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix Q. M >= N >= 0.

       K       (input) INTEGER
               The number of elementary reflectors whose product defines the
               matrix Q. N >= K >= 0.

       A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
               On entry, the i-th column must contain the vector which
               defines the elementary reflector H(i), for i = 1,2,...,k, as
               returned by DGEQRF in the first k columns of its array
               argument A.
               On exit, the M-by-N matrix Q.

       LDA     (input) INTEGER
               The first dimension of the array A. LDA >= max(1,M).

       TAU     (input) DOUBLE PRECISION array, dimension (K)
               TAU(i) must contain the scalar factor of the elementary
               reflector H(i), as returned by DGEQRF.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK. LWORK >= max(1,N).
               For optimum performance LWORK >= N*NB, where NB is the
               optimal blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument has an illegal value

       =====================================================================

### Inputs

Name | Description
--- | ---
Q[:, :] | Orthogonal matrix as a result of elementary reflectors
tau[:] | scalar factors of the elementary reflectors

### Outputs

Name | Description
--- | ---
Aout[size(Q, 1), size(Q, 1)] |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dormhr

overwrites the general real M-by-N matrix C with Q * C or C * Q or Q' * C or C * Q', where Q is an orthogonal matrix as returne by dgehrd

### Information

       Purpose
       =======

         DORMHR overwrites the general real M-by-N matrix C with

                       SIDE = 'L'     SIDE = 'R'
       TRANS = 'N':      Q * C          C * Q
       TRANS = 'T':      Q**T * C       C * Q**T

       where Q is a real orthogonal matrix of order nq, with nq = m if
       SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
       IHI-ILO elementary reflectors, as returned by DGEHRD:

       Q = H(ilo) H(ilo+1) . . . H(ihi-1).

       Arguments
       =========

       SIDE    (input) CHARACTER*1
               = 'L': apply Q or Q**T from the Left;
               = 'R': apply Q or Q**T from the Right.

       TRANS   (input) CHARACTER*1
               = 'N':  No transpose, apply Q;
               = 'T':  Transpose, apply Q**T.

       M       (input) INTEGER
               The number of rows of the matrix C. M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix C. N >= 0.

       ILO     (input) INTEGER
       IHI     (input) INTEGER
               ILO and IHI must have the same values as in the previous call
               of DGEHRD. Q is equal to the unit matrix except in the
               submatrix Q(ilo+1:ihi,ilo+1:ihi).
               If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and
               ILO = 1 and IHI = 0, if M = 0;
               if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and
               ILO = 1 and IHI = 0, if N = 0.

       A       (input) DOUBLE PRECISION array, dimension
                                    (LDA,M) if SIDE = 'L'
                                    (LDA,N) if SIDE = 'R'
               The vectors which define the elementary reflectors, as
               returned by DGEHRD.

       LDA     (input) INTEGER
               The leading dimension of the array A.
               LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.

       TAU     (input) DOUBLE PRECISION array, dimension
                                    (M-1) if SIDE = 'L'
                                    (N-1) if SIDE = 'R'
               TAU(i) must contain the scalar factor of the elementary
               reflector H(i), as returned by DGEHRD.

       C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
               On entry, the M-by-N matrix C.
               On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.

       LDC     (input) INTEGER
               The leading dimension of the array C. LDC >= max(1,M).

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.
               If SIDE = 'L', LWORK >= max(1,N);
               if SIDE = 'R', LWORK >= max(1,M).
               For optimum performance LWORK >= N*NB if SIDE = 'L', and
               LWORK >= M*NB if SIDE = 'R', where NB is the optimal
               blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value

       =====================================================================

### Inputs

Name | Description
--- | ---
C[:, :] |
A[:, :] |
tau[if side == "L" then size(C, 2) - 1 else size(C, 1) - 1] |
side |
trans |
ilo | lowest index where the original matrix had been Hessenbergform
ihi | highest index where the original matrix had been Hessenbergform

### Outputs

Name | Description
--- | ---
Cout[size(C, 1), size(C, 2)] | contains the Hessenberg form in the upper triangle and the first subdiagonal and below the first subdiagonal it contains the elementary reflectors which represents (with array tau) as a product the orthogonal matrix Q
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dormqr

overwrites the general real M-by-N matrix C with Q * C or C * Q or Q' * C or C * Q', where Q is an orthogonal matrix of a QR factorization as returned by dgeqrf

### Information

       Purpose
       =======

       DORMQR overwrites the general real M-by-N matrix C with

                       SIDE = 'L'     SIDE = 'R'
       TRANS = 'N':      Q * C          C * Q
       TRANS = 'T':      Q**T * C       C * Q**T

       where Q is a real orthogonal matrix defined as the product of k
       elementary reflectors

             Q = H(1) H(2) . . . H(k)

       as returned by DGEQRF. Q is of order M if SIDE = 'L' and of order N
       if SIDE = 'R'.

       Arguments
       =========

       SIDE    (input) CHARACTER*1
               = 'L': apply Q or Q**T from the Left;
               = 'R': apply Q or Q**T from the Right.

       TRANS   (input) CHARACTER*1
               = 'N':  No transpose, apply Q;
               = 'T':  Transpose, apply Q**T.

       M       (input) INTEGER
               The number of rows of the matrix C. M >= 0.

       N       (input) INTEGER
               The number of columns of the matrix C. N >= 0.

       K       (input) INTEGER
               The number of elementary reflectors whose product defines
               the matrix Q.
               If SIDE = 'L', M >= K >= 0;
               if SIDE = 'R', N >= K >= 0.

       A       (input) DOUBLE PRECISION array, dimension (LDA,K)
               The i-th column must contain the vector which defines the
               elementary reflector H(i), for i = 1,2,...,k, as returned by
               DGEQRF in the first k columns of its array argument A.
               A is modified by the routine but restored on exit.

       LDA     (input) INTEGER
               The leading dimension of the array A.
               If SIDE = 'L', LDA >= max(1,M);
               if SIDE = 'R', LDA >= max(1,N).

       TAU     (input) DOUBLE PRECISION array, dimension (K)
               TAU(i) must contain the scalar factor of the elementary
               reflector H(i), as returned by DGEQRF.

       C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
               On entry, the M-by-N matrix C.
               On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.

       LDC     (input) INTEGER
               The leading dimension of the array C. LDC >= max(1,M).

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.
               If SIDE = 'L', LWORK >= max(1,N);
               if SIDE = 'R', LWORK >= max(1,M).
               For optimum performance LWORK >= N*NB if SIDE = 'L', and
               LWORK >= M*NB if SIDE = 'R', where NB is the optimal
               blocksize.

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0:  successful exit
               < 0:  if INFO = -i, the i-th argument had an illegal value

       =====================================================================

### Inputs

Name | Description
--- | ---
C[:, :] |
A[:, :] |
tau[:] |
side |
trans |

### Outputs

Name | Description
--- | ---
Cout[size(C, 1), size(C, 2)] | contains Q*C or Q**T*C or C*Q**T or C*Q
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrevc

compute the right and/or left eigenvectors of a real upper quasi-triangular matrix T

### Information

        /*  DTREVC computes some or all of the right and/or left eigenvectors of
     a real upper quasi-triangular matrix T.
     Matrices of this type are produced by the Schur factorization of
     a real general matrix:  A = Q*T*Q**T, as computed by DHSEQR.

     The right eigenvector x and the left eigenvector y of T corresponding
     to an eigenvalue w are defined by:

        T*x = w*x,     (y**H)*T = w*(y**H)

     where y**H denotes the conjugate transpose of y.
     The eigenvalues are not input to this routine, but are read directly
     from the diagonal blocks of T.

     This routine returns the matrices X and/or Y of right and left
     eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an
     input matrix.  If Q is the orthogonal factor that reduces a matrix
     A to Schur form T, then Q*X and Q*Y are the matrices of right and
     left eigenvectors of A.

     Arguments
     =========

     SIDE    (input) CHARACTER*1
             = 'R':  compute right eigenvectors only;
             = 'L':  compute left eigenvectors only;
             = 'B':  compute both right and left eigenvectors.

     HOWMNY  (input) CHARACTER*1
             = 'A':  compute all right and/or left eigenvectors;
             = 'B':  compute all right and/or left eigenvectors,
                     backtransformed by the matrices in VR and/or VL;
             = 'S':  compute selected right and/or left eigenvectors,
                     as indicated by the logical array SELECT.

     SELECT  (input/output) LOGICAL array, dimension (N)
             If HOWMNY = 'S', SELECT specifies the eigenvectors to be
             computed.
             If w(j) is a real eigenvalue, the corresponding real
             eigenvector is computed if SELECT(j) is .TRUE..
             If w(j) and w(j+1) are the real and imaginary parts of a
             complex eigenvalue, the corresponding complex eigenvector is
             computed if either SELECT(j) or SELECT(j+1) is .TRUE., and
             on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to
             .FALSE..
             Not referenced if HOWMNY = 'A' or 'B'.

     N       (input) INTEGER
             The order of the matrix T. N >= 0.

     T       (input) DOUBLE PRECISION array, dimension (LDT,N)
             The upper quasi-triangular matrix T in Schur canonical form.

     LDT     (input) INTEGER
             The leading dimension of the array T. LDT >= max(1,N).

     VL      (input/output) DOUBLE PRECISION array, dimension (LDVL,MM)
             On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must
             contain an N-by-N matrix Q (usually the orthogonal matrix Q
             of Schur vectors returned by DHSEQR).
             On exit, if SIDE = 'L' or 'B', VL contains:
             if HOWMNY = 'A', the matrix Y of left eigenvectors of T;
             if HOWMNY = 'B', the matrix Q*Y;
             if HOWMNY = 'S', the left eigenvectors of T specified by
                              SELECT, stored consecutively in the columns
                              of VL, in the same order as their
                              eigenvalues.
             A complex eigenvector corresponding to a complex eigenvalue
             is stored in two consecutive columns, the first holding the
             real part, and the second the imaginary part.
             Not referenced if SIDE = 'R'.

     LDVL    (input) INTEGER
             The leading dimension of the array VL.  LDVL >= 1, and if
             SIDE = 'L' or 'B', LDVL >= N.

     VR      (input/output) DOUBLE PRECISION array, dimension (LDVR,MM)
             On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
             contain an N-by-N matrix Q (usually the orthogonal matrix Q
             of Schur vectors returned by DHSEQR).
             On exit, if SIDE = 'R' or 'B', VR contains:
             if HOWMNY = 'A', the matrix X of right eigenvectors of T;
             if HOWMNY = 'B', the matrix Q*X;
             if HOWMNY = 'S', the right eigenvectors of T specified by
                              SELECT, stored consecutively in the columns
                              of VR, in the same order as their
                              eigenvalues.
             A complex eigenvector corresponding to a complex eigenvalue
             is stored in two consecutive columns, the first holding the
             real part and the second the imaginary part.
             Not referenced if SIDE = 'L'.

     LDVR    (input) INTEGER
             The leading dimension of the array VR.  LDVR >= 1, and if
             SIDE = 'R' or 'B', LDVR >= N.

     MM      (input) INTEGER
             The number of columns in the arrays VL and/or VR. MM >= M.

     M       (output) INTEGER
             The number of columns in the arrays VL and/or VR actually
             used to store the eigenvectors.
             If HOWMNY = 'A' or 'B', M is set to N.
             Each selected real eigenvector occupies one column and each
             selected complex eigenvector occupies two columns.

     WORK    (workspace) DOUBLE PRECISION array, dimension (3*N)

     INFO    (output) INTEGER
             = 0:  successful exit
             < 0:  if INFO = -i, the i-th argument had an illegal value

     Further Details
     ===============

     The algorithm used in this program is basically backward (forward)
     substitution, with scaling to make the the code robust against
     possible overflow.

     Each eigenvector is normalized so that the element of largest
     magnitude has magnitude 1; here the magnitude of a complex number
     (x,y) is taken to be |x| + |y|.

       =====================================================================

### Inputs

Name | Description
--- | ---
T[:, size(T, 1)] |
side |
howmny |
Q[size(T, 1), size(T, 1)] |

### Outputs

Name | Description
--- | ---
lEigenVectors[size(T, 1), size(T, 1)] | left eigenvectors of matrix T
rEigenVectors[size(T, 1), size(T, 1)] | right eigenvectors of matrix T
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrsen

DTRSEN reorders the real Schur factorization of a real matrix

### Information

       Purpose
       =======

         DTRSEN reorders the real Schur factorization of a real matrix
       A = Q*T*Q**T, so that a selected cluster of eigenvalues appears in
       the leading diagonal blocks of the upper quasi-triangular matrix T,
       and the leading columns of Q form an orthonormal basis of the
       corresponding right invariant subspace.

       Optionally the routine computes the reciprocal condition numbers of
       the cluster of eigenvalues and/or the invariant subspace.

       T must be in Schur canonical form (as returned by DHSEQR), that is,
       block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each
       2-by-2 diagonal block has its diagonal elemnts equal and its
       off-diagonal elements of opposite sign.

       Arguments
       =========

       JOB     (input) CHARACTER*1
               Specifies whether condition numbers are required for the
               cluster of eigenvalues (S) or the invariant subspace (SEP):
               = 'N': none;
               = 'E': for eigenvalues only (S);
               = 'V': for invariant subspace only (SEP);
               = 'B': for both eigenvalues and invariant subspace (S and
                      SEP).

       COMPQ   (input) CHARACTER*1
               = 'V': update the matrix Q of Schur vectors;
               = 'N': do not update Q.

       SELECT  (input) LOGICAL array, dimension (N)
               SELECT specifies the eigenvalues in the selected cluster. To
               select a real eigenvalue w(j), SELECT(j) must be set to
               .TRUE.. To select a complex conjugate pair of eigenvalues
               w(j) and w(j+1), corresponding to a 2-by-2 diagonal block,
               either SELECT(j) or SELECT(j+1) or both must be set to
               .TRUE.; a complex conjugate pair of eigenvalues must be
               either both included in the cluster or both excluded.

       N       (input) INTEGER
               The order of the matrix T. N >= 0.

       T       (input/output) DOUBLE PRECISION array, dimension (LDT,N)
               On entry, the upper quasi-triangular matrix T, in Schur
               canonical form.
               On exit, T is overwritten by the reordered matrix T, again in
               Schur canonical form, with the selected eigenvalues in the
               leading diagonal blocks.

       LDT     (input) INTEGER
               The leading dimension of the array T. LDT >= max(1,N).

       Q       (input/output) DOUBLE PRECISION array, dimension (LDQ,N)
               On entry, if COMPQ = 'V', the matrix Q of Schur vectors.
               On exit, if COMPQ = 'V', Q has been postmultiplied by the
               orthogonal transformation matrix which reorders T; the
               leading M columns of Q form an orthonormal basis for the
               specified invariant subspace.
               If COMPQ = 'N', Q is not referenced.

       LDQ     (input) INTEGER
               The leading dimension of the array Q.
               LDQ >= 1; and if COMPQ = 'V', LDQ >= N.

       WR      (output) DOUBLE PRECISION array, dimension (N)
       WI      (output) DOUBLE PRECISION array, dimension (N)
               The real and imaginary parts, respectively, of the reordered
               eigenvalues of T. The eigenvalues are stored in the same
               order as on the diagonal of T, with WR(i) = T(i,i) and, if
               T(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) > 0 and
               WI(i+1) = -WI(i). Note that if a complex eigenvalue is
               sufficiently ill-conditioned, then its value may differ
               significantly from its value before reordering.

       M       (output) INTEGER
               The dimension of the specified invariant subspace.
               0 < = M <= N.

       S       (output) DOUBLE PRECISION
               If JOB = 'E' or 'B', S is a lower bound on the reciprocal
               condition number for the selected cluster of eigenvalues.
               S cannot underestimate the true reciprocal condition number
               by more than a factor of sqrt(N). If M = 0 or N, S = 1.
               If JOB = 'N' or 'V', S is not referenced.

       SEP     (output) DOUBLE PRECISION
               If JOB = 'V' or 'B', SEP is the estimated reciprocal
               condition number of the specified invariant subspace. If
               M = 0 or N, SEP = norm(T).
               If JOB = 'N' or 'E', SEP is not referenced.

       WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

       LWORK   (input) INTEGER
               The dimension of the array WORK.
               If JOB = 'N', LWORK >= max(1,N);
               if JOB = 'E', LWORK >= M*(N-M);
               if JOB = 'V' or 'B', LWORK >= 2*M*(N-M).

               If LWORK = -1, then a workspace query is assumed; the routine
               only calculates the optimal size of the WORK array, returns
               this value as the first entry of the WORK array, and no error
               message related to LWORK is issued by XERBLA.

       IWORK   (workspace) INTEGER array, dimension (LIWORK)
               IF JOB = 'N' or 'E', IWORK is not referenced.

       LIWORK  (input) INTEGER
               The dimension of the array IWORK.
               If JOB = 'N' or 'E', LIWORK >= 1;
               if JOB = 'V' or 'B', LIWORK >= M*(N-M).

               If LIWORK = -1, then a workspace query is assumed; the
               routine only calculates the optimal size of the IWORK array,
               returns this value as the first entry of the IWORK array, and
               no error message related to LIWORK is issued by XERBLA.

       INFO    (output) INTEGER
               = 0: successful exit
               < 0: if INFO = -i, the i-th argument had an illegal value
               = 1: reordering of T failed because some eigenvalues are too
                    close to separate (the problem is very ill-conditioned);
                    T may have been partially reordered, and WR and WI
                    contain the eigenvalues in the same order as in T; S and
                    SEP (if requested) are set to zero.

       Further Details
       ===============

       DTRSEN first collects the selected eigenvalues by computing an
       orthogonal transformation Z to move them to the top left corner of T.
       In other words, the selected eigenvalues are the eigenvalues of T11
       in:

                     Z'*T*Z = ( T11 T12 ) n1
                              (  0  T22 ) n2
                                 n1  n2

       where N = n1+n2 and Z' means the transpose of Z. The first n1 columns
       of Z span the specified invariant subspace of T.

       If T has been obtained from the real Schur factorization of a matrix
       A = Q*T*Q', then the reordered real Schur factorization of A is given
       by A = (Q*Z)*(Z'*T*Z)*(Q*Z)', and the first n1 columns of Q*Z span
       the corresponding invariant subspace of A.

       The reciprocal condition number of the average of the eigenvalues of
       T11 may be returned in S. S lies between 0 (very badly conditioned)
       and 1 (very well conditioned). It is computed as follows. First we
       compute R so that

                              P = ( I  R ) n1
                                  ( 0  0 ) n2
                                    n1 n2

       is the projector on the invariant subspace associated with T11.
       R is the solution of the Sylvester equation:

                             T11*R - R*T22 = T12.

       Let F-norm(M) denote the Frobenius-norm of M and 2-norm(M) denote
       the two-norm of M. Then S is computed as the lower bound

                           (1 + F-norm(R)**2)**(-1/2)

       on the reciprocal of 2-norm(P), the true reciprocal condition number.
       S cannot underestimate 1 / 2-norm(P) by more than a factor of
       sqrt(N).

       An approximate error bound for the computed average of the
       eigenvalues of T11 is

                              EPS * norm(T) / S

       where EPS is the machine precision.

       The reciprocal condition number of the right invariant subspace
       spanned by the first n1 columns of Z (or of Q*Z) is returned in SEP.
       SEP is defined as the separation of T11 and T22:

                          sep( T11, T22 ) = sigma-min( C )

       where sigma-min(C) is the smallest singular value of the
       n1*n2-by-n1*n2 matrix

          C  = kprod( I(n2), T11 ) - kprod( transpose(T22), I(n1) )

       I(m) is an m by m identity matrix, and kprod denotes the Kronecker
       product. We estimate sigma-min(C) by the reciprocal of an estimate of
       the 1-norm of inverse(C). The true reciprocal 1-norm of inverse(C)
       cannot differ from sigma-min(C) by more than a factor of sqrt(n1*n2).

       When SEP is small, small changes in T can cause large changes in
       the invariant subspace. An approximate bound on the maximum angular
       error in the computed right invariant subspace is

                           EPS * norm(T) / SEP

       =====================================================================

### Inputs

Name | Description
--- | ---
job |
compq |
select[:] |
T[:, :] |
Q[:, size(T, 2)] |

### Outputs

Name | Description
--- | ---
To[:, :] |
Qo[:, :] |
wr[size(T, 2)] |
wi[size(T, 2)] |
m |
s |
sep |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrsyl

DTRSYL solves the real Sylvester matrix equation

### Information

       Purpose
        =======

        DTRSYL solves the real Sylvester matrix equation:

           op(A)*X + X*op(B) = scale*C or
           op(A)*X - X*op(B) = scale*C,

        where op(A) = A or A**T, and  A and B are both upper quasi-
        triangular. A is M-by-M and B is N-by-N; the right hand side C and
        the solution X are M-by-N; and scale is an output scale factor, set
        <= 1 to avoid overflow in X.

        A and B must be in Schur canonical form (as returned by DHSEQR), that
        is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
        each 2-by-2 diagonal block has its diagonal elements equal and its
        off-diagonal elements of opposite sign.

        Arguments
        =========

        TRANA   (input) CHARACTER*1
                Specifies the option op(A):
                = 'N': op(A) = A    (No transpose)
                = 'T': op(A) = A**T (Transpose)
                = 'C': op(A) = A**H (Conjugate transpose = Transpose)

        TRANB   (input) CHARACTER*1
                Specifies the option op(B):
                = 'N': op(B) = B    (No transpose)
                = 'T': op(B) = B**T (Transpose)
                = 'C': op(B) = B**H (Conjugate transpose = Transpose)

        ISGN    (input) INTEGER
                Specifies the sign in the equation:
                = +1: solve op(A)*X + X*op(B) = scale*C
                = -1: solve op(A)*X - X*op(B) = scale*C

        M       (input) INTEGER
                The order of the matrix A, and the number of rows in the
                matrices X and C. M >= 0.

        N       (input) INTEGER
                The order of the matrix B, and the number of columns in the
                matrices X and C. N >= 0.

        A       (input) DOUBLE PRECISION array, dimension (LDA,M)
                The upper quasi-triangular matrix A, in Schur canonical form.

        LDA     (input) INTEGER
                The leading dimension of the array A. LDA >= max(1,M).

        B       (input) DOUBLE PRECISION array, dimension (LDB,N)
                The upper quasi-triangular matrix B, in Schur canonical form.

        LDB     (input) INTEGER
                The leading dimension of the array B. LDB >= max(1,N).

        C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
                On entry, the M-by-N right hand side matrix C.
                On exit, C is overwritten by the solution matrix X.

        LDC     (input) INTEGER
                The leading dimension of the array C. LDC >= max(1,M)

        SCALE   (output) DOUBLE PRECISION
                The scale factor, scale, set <= 1 to avoid overflow in X.

        INFO    (output) INTEGER
                = 0: successful exit
                < 0: if INFO = -i, the i-th argument had an illegal value
                = 1: A and B have common or very close eigenvalues; perturbed
                     values were used to solve the equation (but the matrices
                     A and B are unchanged).

        =====================================================================

       DTRSEN first collects the selected eigenvalues by computing an
       orthogonal transformation Z to move them to the top left corner of T.
       In other words, the selected eigenvalues are the eigenvalues of T11
       in:

                     Z'*T*Z = ( T11 T12 ) n1
                              (  0  T22 ) n2
                                 n1  n2

       where N = n1+n2 and Z' means the transpose of Z. The first n1 columns
       of Z span the specified invariant subspace of T.

       If T has been obtained from the real Schur factorization of a matrix
       A = Q*T*Q', then the reordered real Schur factorization of A is given
       by A = (Q*Z)*(Z'*T*Z)*(Q*Z)', and the first n1 columns of Q*Z span
       the corresponding invariant subspace of A.

       The reciprocal condition number of the average of the eigenvalues of
       T11 may be returned in S. S lies between 0 (very badly conditioned)
       and 1 (very well conditioned). It is computed as follows. First we
       compute R so that

                              P = ( I  R ) n1
                                  ( 0  0 ) n2
                                    n1 n2

       is the projector on the invariant subspace associated with T11.
       R is the solution of the Sylvester equation:

                             T11*R - R*T22 = T12.

       Let F-norm(M) denote the Frobenius-norm of M and 2-norm(M) denote
       the two-norm of M. Then S is computed as the lower bound

                           (1 + F-norm(R)**2)**(-1/2)

       on the reciprocal of 2-norm(P), the true reciprocal condition number.
       S cannot underestimate 1 / 2-norm(P) by more than a factor of
       sqrt(N).

       An approximate error bound for the computed average of the
       eigenvalues of T11 is

                              EPS * norm(T) / S

       where EPS is the machine precision.

       The reciprocal condition number of the right invariant subspace
       spanned by the first n1 columns of Z (or of Q*Z) is returned in SEP.
       SEP is defined as the separation of T11 and T22:

                          sep( T11, T22 ) = sigma-min( C )

       where sigma-min(C) is the smallest singular value of the
       n1*n2-by-n1*n2 matrix

          C  = kprod( I(n2), T11 ) - kprod( transpose(T22), I(n1) )

       I(m) is an m by m identity matrix, and kprod denotes the Kronecker
       product. We estimate sigma-min(C) by the reciprocal of an estimate of
       the 1-norm of inverse(C). The true reciprocal 1-norm of inverse(C)
       cannot differ from sigma-min(C) by more than a factor of sqrt(n1*n2).

       When SEP is small, small changes in T can cause large changes in
       the invariant subspace. An approximate bound on the maximum angular
       error in the computed right invariant subspace is

                           EPS * norm(T) / SEP

       =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] |
B[:, :] |
C[if tranA then size(A, 1) else size(A, 2), if tranB then size(B, 1) else size(B, 2)] |
tranA |
tranB |
isgn |

### Outputs

Name | Description
--- | ---
X[size(C, 1), size(C, 2)] |
scale |
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgelsx

Computes the minimum-norm solution to a real linear least squares problem with rank deficient A

### Information

    Lapack documentation
      Purpose
      =======

      DGELSX computes the minimum-norm solution to a real linear least
      squares problem:
          minimize || A * X - B ||
      using a complete orthogonal factorization of A.  A is an M-by-N
      matrix which may be rank-deficient.

      Several right hand side vectors b and solution vectors x can be
      handled in a single call; they are stored as the columns of the
      M-by-NRHS right hand side matrix B and the N-by-NRHS solution
      matrix X.

      The routine first computes a QR factorization with column pivoting:
          A * P = Q * [ R11 R12 ]
                      [  0  R22 ]
      with R11 defined as the largest leading submatrix whose estimated
      condition number is less than 1/RCOND.  The order of R11, RANK,
      is the effective rank of A.

      Then, R22 is considered to be negligible, and R12 is annihilated
      by orthogonal transformations from the right, arriving at the
      complete orthogonal factorization:
         A * P = Q * [ T11 0 ] * Z
                     [  0  0 ]
      The minimum-norm solution is then
         X = P * Z' [ inv(T11)*Q1'*B ]
                    [        0       ]
      where Q1 consists of the first RANK columns of Q.

      Arguments
      =========

      M       (input) INTEGER
              The number of rows of the matrix A.  M >= 0.

      N       (input) INTEGER
              The number of columns of the matrix A.  N >= 0.

      NRHS    (input) INTEGER
              The number of right hand sides, i.e., the number of
              columns of matrices B and X. NRHS >= 0.

      A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
              On entry, the M-by-N matrix A.
              On exit, A has been overwritten by details of its
              complete orthogonal factorization.

      LDA     (input) INTEGER
              The leading dimension of the array A.  LDA >= max(1,M).

      B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
              On entry, the M-by-NRHS right hand side matrix B.
              On exit, the N-by-NRHS solution matrix X.
              If m >= n and RANK = n, the residual sum-of-squares for
              the solution in the i-th column is given by the sum of
              squares of elements N+1:M in that column.

      LDB     (input) INTEGER
              The leading dimension of the array B. LDB >= max(1,M,N).

      JPVT    (input/output) INTEGER array, dimension (N)
              On entry, if JPVT(i) .ne. 0, the i-th column of A is an
              initial column, otherwise it is a free column.  Before
              the QR factorization of A, all initial columns are
              permuted to the leading positions; only the remaining
              free columns are moved as a result of column pivoting
              during the factorization.
              On exit, if JPVT(i) = k, then the i-th column of A*P
              was the k-th column of A.

      RCOND   (input) DOUBLE PRECISION
              RCOND is used to determine the effective rank of A, which
              is defined as the order of the largest leading triangular
              submatrix R11 in the QR factorization with pivoting of A,
              whose estimated condition number < 1/RCOND.

      RANK    (output) INTEGER
              The effective rank of A, i.e., the order of the submatrix
              R11.  This is the same as the order of the submatrix T11
              in the complete orthogonal factorization of A.

      WORK    (workspace) DOUBLE PRECISION array, dimension
                          (max( min(M,N)+3*N, 2*min(M,N)+NRHS )),

      INFO    (output) INTEGER
              = 0:  successful exit
              < 0:  if INFO = -i, the i-th argument had an illegal value

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, :] |
B[size(A, 1), :] |
rcond | Reciprocal condition number to estimate rank

### Outputs

Name | Description
--- | ---
X[max(nrow, ncol), nrhs] | Solution is in first size(A,2) rows
info |
rank | Effective rank of A

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgemm

Blas algorithm to perform C:=a*op(A)*op(B) + b*C (a,b scalars, ABC matrices)

### Information

    Purpose
        =======
        DGEMM  performs one of the matrix-matrix operations
           C := alpha*op( A )*op( B ) + beta*C,
        where  op( X ) is one of
           op( X ) = X   or   op( X ) = X',
        alpha and beta are scalars, and A, B and C are matrices, with op( A )
        an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix.
        Arguments
        ==========
        TRANSA - CHARACTER*1.
                 On entry, TRANSA specifies the form of op( A ) to be used in
                 the matrix multiplication as follows:
                    TRANSA = 'N' or 'n',  op( A ) = A.
                    TRANSA = 'T' or 't',  op( A ) = A'.
                    TRANSA = 'C' or 'c',  op( A ) = A'.
                 Unchanged on exit.
        TRANSB - CHARACTER*1.
                 On entry, TRANSB specifies the form of op( B ) to be used in
                 the matrix multiplication as follows:
                    TRANSB = 'N' or 'n',  op( B ) = B.
                    TRANSB = 'T' or 't',  op( B ) = B'.
                    TRANSB = 'C' or 'c',  op( B ) = B'.
                 Unchanged on exit.
        M      - INTEGER.
                 On entry,  M  specifies  the number  of rows  of the  matrix
                 op( A )  and of the  matrix  C.  M  must  be at least  zero.
                 Unchanged on exit.
        N      - INTEGER.
                 On entry,  N  specifies the number  of columns of the matrix
                 op( B ) and the number of columns of the matrix C. N must be
                 at least zero.
                 Unchanged on exit.
        K      - INTEGER.
                 On entry,  K  specifies  the number of columns of the matrix
                 op( A ) and the number of rows of the matrix op( B ). K must
                 be at least  zero.
                 Unchanged on exit.
        ALPHA  - DOUBLE PRECISION.
                 On entry, ALPHA specifies the scalar alpha.
                 Unchanged on exit.
        A      - DOUBLE PRECISION array of DIMENSION ( LDA, ka ), where ka is
                 k  when  TRANSA = 'N' or 'n',  and is  m  otherwise.
                 Before entry with  TRANSA = 'N' or 'n',  the leading  m by k
                 part of the array  A  must contain the matrix  A,  otherwise
                 the leading  k by m  part of the array  A  must contain  the
                 matrix A.
                 Unchanged on exit.
        LDA    - INTEGER.
                 On entry, LDA specifies the first dimension of A as declared
                 in the calling (sub) program. When  TRANSA = 'N' or 'n' then
                 LDA must be at least  max( 1, m ), otherwise  LDA must be at
                 least  max( 1, k ).
                 Unchanged on exit.
        B      - DOUBLE PRECISION array of DIMENSION ( LDB, kb ), where kb is
                 n  when  TRANSB = 'N' or 'n',  and is  k  otherwise.
                 Before entry with  TRANSB = 'N' or 'n',  the leading  k by n
                 part of the array  B  must contain the matrix  B,  otherwise
                 the leading  n by k  part of the array  B  must contain  the
                 matrix B.
                 Unchanged on exit.
        LDB    - INTEGER.
                 On entry, LDB specifies the first dimension of B as declared
                 in the calling (sub) program. When  TRANSB = 'N' or 'n' then
                 LDB must be at least  max( 1, k ), otherwise  LDB must be at
                 least  max( 1, n ).
                 Unchanged on exit.
        BETA   - DOUBLE PRECISION.
                 On entry,  BETA  specifies the scalar  beta.  When  BETA  is
                 supplied as zero then C need not be set on input.
                 Unchanged on exit.
        C      - DOUBLE PRECISION array of DIMENSION ( LDC, n ).
                 Before entry, the leading  m by n  part of the array  C must
                 contain the matrix  C,  except when  beta  is zero, in which
                 case C need not be set on entry.
                 On exit, the array  C  is overwritten by the  m by n  matrix
                 ( alpha*op( A )*op( B ) + beta*C ).
        LDC    - INTEGER.
                 On entry, LDC specifies the first dimension of C as declared
                 in  the  calling  (sub)  program.   LDC  must  be  at  least
                 max( 1, m ).
                 Unchanged on exit.
        Level 3 Blas routine.

### Inputs

Name | Description
--- | ---
A[:, :] | Input matrix A
B[:, :] | Input matrix B
C[:, :] | Input matrix C
a | Factor a
b | Factor b
transA | True if transformed A is used
transB | True if transformed B is used

### Outputs

Name | Description
--- | ---
Cout[size(C, 1), size(C, 2)] | Matrix Cout

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrmm

Blas algorithm to perform B := alpha*op( A )*B, or B := alpha*B*op( A ) with triangular matrix A

### Information

      Purpose
        =======
        DTRMM  performs one of the matrix-matrix operations
           B := alpha*op( A )*B,   or   B := alpha*B*op( A ),
        where  alpha  is a scalar,  B  is an m by n matrix,  A  is a unit, or
        non-unit,  upper or lower triangular matrix  and  op( A )  is one  of
           op( A ) = A   or   op( A ) = A'.
        Arguments
        ==========
        SIDE   - CHARACTER*1.
                 On entry,  SIDE specifies whether  op( A ) multiplies B from
                 the left or right as follows:
                    SIDE = 'L' or 'l'   B := alpha*op( A )*B.
                    SIDE = 'R' or 'r'   B := alpha*B*op( A ).
                 Unchanged on exit.
        UPLO   - CHARACTER*1.
                 On entry, UPLO specifies whether the matrix A is an upper or
                 lower triangular matrix as follows:
                    UPLO = 'U' or 'u'   A is an upper triangular matrix.
                    UPLO = 'L' or 'l'   A is a lower triangular matrix.
                 Unchanged on exit.
        TRANSA - CHARACTER*1.
                 On entry, TRANSA specifies the form of op( A ) to be used in
                 the matrix multiplication as follows:
                    TRANSA = 'N' or 'n'   op( A ) = A.
                    TRANSA = 'T' or 't'   op( A ) = A'.
                    TRANSA = 'C' or 'c'   op( A ) = A'.
                 Unchanged on exit.
        DIAG   - CHARACTER*1.
                 On entry, DIAG specifies whether or not A is unit triangular
                 as follows:
                    DIAG = 'U' or 'u'   A is assumed to be unit triangular.
                    DIAG = 'N' or 'n'   A is not assumed to be unit
                                        triangular.
                 Unchanged on exit.
        M      - INTEGER.
                 On entry, M specifies the number of rows of B. M must be at
                 least zero.
                 Unchanged on exit.
        N      - INTEGER.
                 On entry, N specifies the number of columns of B.  N must be
                 at least zero.
                 Unchanged on exit.
        ALPHA  - DOUBLE PRECISION.
                 On entry,  ALPHA specifies the scalar  alpha. When  alpha is
                 zero then  A is not referenced and  B need not be set before
                 entry.
                 Unchanged on exit.
        A      - DOUBLE PRECISION array of DIMENSION ( LDA, k ), where k is m
                 when  SIDE = 'L' or 'l'  and is  n  when  SIDE = 'R' or 'r'.
                 Before entry  with  UPLO = 'U' or 'u',  the  leading  k by k
                 upper triangular part of the array  A must contain the upper
                 triangular matrix  and the strictly lower triangular part of
                 A is not referenced.
                 Before entry  with  UPLO = 'L' or 'l',  the  leading  k by k
                 lower triangular part of the array  A must contain the lower
                 triangular matrix  and the strictly upper triangular part of
                 A is not referenced.
                 Note that when  DIAG = 'U' or 'u',  the diagonal elements of
                 A  are not referenced either,  but are assumed to be  unity.
                 Unchanged on exit.
        LDA    - INTEGER.
                 On entry, LDA specifies the first dimension of A as declared
                 in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
                 LDA  must be at least  max( 1, m ),  when  SIDE = 'R' or 'r'
                 then LDA must be at least max( 1, n ).
                 Unchanged on exit.
        B      - DOUBLE PRECISION array of DIMENSION ( LDB, n ).
                 Before entry,  the leading  m by n part of the array  B must
                 contain the matrix  B,  and  on exit  is overwritten  by the
                 transformed matrix.
        LDB    - INTEGER.
                 On entry, LDB specifies the first dimension of B as declared
                 in  the  calling  (sub)  program.   LDB  must  be  at  least
                 max( 1, m ).
                 Unchanged on exit.
        Level 3 Blas routine.

### Inputs

Name | Description
--- | ---
A[:, :] | Input matrix A
B[:, :] | Input matrix B
alpha | Factor alpha
right | True if A is right multiplication
upper | True if A is upper triangular
trans | True if op(A) means transposed(A)
unitTriangular | True if A is unit triangular, i.e. all diagonal elements of A are equal to 1

### Outputs

Name | Description
--- | ---
Bout[size(B, 1), size(B, 2)] | Matrix Bout=alpha*op( A )*B, or B := alpha*B*op( A )

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dpotrf

Computes the Cholesky factorization of a real symmetric positive definite matrix A

### Information

    Lapack documentation
        Purpose
        =======

        DPOTRF computes the Cholesky factorization of a real symmetric
        positive definite matrix A.

        The factorization has the form
           A = U**T * U,  if UPLO = 'U', or
           A = L  * L**T,  if UPLO = 'L',
        where U is an upper triangular matrix and L is lower triangular.

        This is the block version of the algorithm, calling Level 3 BLAS.

        Arguments
        =========

        UPLO    (input) CHARACTER*1
                = 'U':  Upper triangle of A is stored;
                = 'L':  Lower triangle of A is stored.

        N       (input) INTEGER
                The order of the matrix A.  N >= 0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the symmetric matrix A.  If UPLO = 'U', the leading
                N-by-N upper triangular part of A contains the upper
                triangular part of the matrix A, and the strictly lower
                triangular part of A is not referenced.  If UPLO = 'L', the
                leading N-by-N lower triangular part of A contains the lower
                triangular part of the matrix A, and the strictly upper
                triangular part of A is not referenced.

                On exit, if INFO = 0, the factor U or L from the Cholesky
                factorization A = U**T*U or A = L*L**T.

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value
                > 0:  if INFO = i, the leading minor of order i is not
                      positive definite, and the factorization could not be
                      completed.

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] | Real symmetric positive definite matrix A
upper | True if the upper triangle of A is provided

### Outputs

Name | Description
--- | ---
Acholesky[size(A, 1), size(A, 1)] | Cholesky factor
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrsm

Solve one of the matrix equations op( A )*X = alpha*B, or X*op( A ) = alpha*B, where A is triangular matrix. BLAS routine

### Information

       Purpose
        =======
        DTRSM  solves one of the matrix equations
           op( A )*X = alpha*B,   or   X*op( A ) = alpha*B,
        where alpha is a scalar, X and B are m by n matrices, A is a unit, or
        non-unit,  upper or lower triangular matrix  and  op( A )  is one  of
           op( A ) = A   or   op( A ) = A'.
        The matrix X is overwritten on B.
        Arguments
        ==========
        SIDE   - CHARACTER*1.
                 On entry, SIDE specifies whether op( A ) appears on the left
                 or right of X as follows:
                    SIDE = 'L' or 'l'   op( A )*X = alpha*B.
                    SIDE = 'R' or 'r'   X*op( A ) = alpha*B.
                 Unchanged on exit.
        UPLO   - CHARACTER*1.
                 On entry, UPLO specifies whether the matrix A is an upper or
                 lower triangular matrix as follows:
                    UPLO = 'U' or 'u'   A is an upper triangular matrix.
                    UPLO = 'L' or 'l'   A is a lower triangular matrix.
                 Unchanged on exit.
        TRANSA - CHARACTER*1.
                 On entry, TRANSA specifies the form of op( A ) to be used in
                 the matrix multiplication as follows:
                    TRANSA = 'N' or 'n'   op( A ) = A.
                    TRANSA = 'T' or 't'   op( A ) = A'.
                    TRANSA = 'C' or 'c'   op( A ) = A'.
                 Unchanged on exit.
        DIAG   - CHARACTER*1.
                 On entry, DIAG specifies whether or not A is unit triangular
                 as follows:
                    DIAG = 'U' or 'u'   A is assumed to be unit triangular.
                    DIAG = 'N' or 'n'   A is not assumed to be unit
                                        triangular.
                 Unchanged on exit.
        M      - INTEGER.
                 On entry, M specifies the number of rows of B. M must be at
                 least zero.
                 Unchanged on exit.
        N      - INTEGER.
                 On entry, N specifies the number of columns of B.  N must be
                 at least zero.
                 Unchanged on exit.
        ALPHA  - DOUBLE PRECISION.
                 On entry,  ALPHA specifies the scalar  alpha. When  alpha is
                 zero then  A is not referenced and  B need not be set before
                 entry.
                 Unchanged on exit.
        A      - DOUBLE PRECISION array of DIMENSION ( LDA, k ), where k is m
                 when  SIDE = 'L' or 'l'  and is  n  when  SIDE = 'R' or 'r'.
                 Before entry  with  UPLO = 'U' or 'u',  the  leading  k by k
                 upper triangular part of the array  A must contain the upper
                 triangular matrix  and the strictly lower triangular part of
                 A is not referenced.
                 Before entry  with  UPLO = 'L' or 'l',  the  leading  k by k
                 lower triangular part of the array  A must contain the lower
                 triangular matrix  and the strictly upper triangular part of
                 A is not referenced.
                 Note that when  DIAG = 'U' or 'u',  the diagonal elements of
                 A  are not referenced either,  but are assumed to be  unity.
                 Unchanged on exit.
        LDA    - INTEGER.
                 On entry, LDA specifies the first dimension of A as declared
                 in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
                 LDA  must be at least  max( 1, m ),  when  SIDE = 'R' or 'r'
                 then LDA must be at least max( 1, n ).
                 Unchanged on exit.
        B      - DOUBLE PRECISION array of DIMENSION ( LDB, n ).
                 Before entry,  the leading  m by n part of the array  B must
                 contain  the  right-hand  side  matrix  B,  and  on exit  is
                 overwritten by the solution matrix  X.
        LDB    - INTEGER.
                 On entry, LDB specifies the first dimension of B as declared
                 in  the  calling  (sub)  program.   LDB  must  be  at  least
                 max( 1, m ).
                 Unchanged on exit.
        Level 3 Blas routine.

### Inputs

Name | Description
--- | ---
A[:, :] | Input matrix A
B[:, :] | Input matrix B
alpha | Factor alpha
right | True if A is right multiplication
upper | True if A is upper triangular
trans | True if op(A) means transposed(A)
unitTriangular | True if A is unit triangular, i.e. all diagonal elements of A are equal to 1

### Outputs

Name | Description
--- | ---
X[size(B, 1), size(B, 2)] | Solution X

## Modelica_LinearSystems2.Math.Matrices.LAPACK.drot

Applies a plane rotation

### Information

        Purpose
        =======
        applies a plane rotation.

### Inputs

Name | Description
--- | ---
x[:] |
y[size(x, 1)] |
c |
s |
incx |
incy |

### Outputs

Name | Description
--- | ---
xr[size(x, 1)] |
yr[size(x, 1)] |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.drotg

Construct Givens plane rotation

### Information

        Purpose
        =======
        construct givens plane rotation.

### Inputs

Name | Description
--- | ---
a |
b |

### Outputs

Name | Description
--- | ---
c |
s |
r |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dtrsv

Solve one of the matrix equations op( A )*x = B where A is upper or lower triangular matrix. BLAS routine

### Information

     Purpose
        =======
        DTRSV  solves one of the systems of equations
           A*x = b,   or   A'*x = b,
        where b and x are n element vectors and A is an n by n unit, or
        non-unit, upper or lower triangular matrix.
        No test for singularity or near-singularity is included in this
        routine. Such tests must be performed before calling this routine.
        Arguments
        ==========
        UPLO   - CHARACTER*1.
                 On entry, UPLO specifies whether the matrix is an upper or
                 lower triangular matrix as follows:
                    UPLO = 'U' or 'u'   A is an upper triangular matrix.
                    UPLO = 'L' or 'l'   A is a lower triangular matrix.
                 Unchanged on exit.
        TRANS  - CHARACTER*1.
                 On entry, TRANS specifies the equations to be solved as
                 follows:
                    TRANS = 'N' or 'n'   A*x = b.
                    TRANS = 'T' or 't'   A'*x = b.
                    TRANS = 'C' or 'c'   A'*x = b.
                 Unchanged on exit.
        DIAG   - CHARACTER*1.
                 On entry, DIAG specifies whether or not A is unit
                 triangular as follows:
                    DIAG = 'U' or 'u'   A is assumed to be unit triangular.
                    DIAG = 'N' or 'n'   A is not assumed to be unit
                                        triangular.
                 Unchanged on exit.
        N      - INTEGER.
                 On entry, N specifies the order of the matrix A.
                 N must be at least zero.
                 Unchanged on exit.
        A      - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
                 Before entry with  UPLO = 'U' or 'u', the leading n by n
                 upper triangular part of the array A must contain the upper
                 triangular matrix and the strictly lower triangular part of
                 A is not referenced.
                 Before entry with UPLO = 'L' or 'l', the leading n by n
                 lower triangular part of the array A must contain the lower
                 triangular matrix and the strictly upper triangular part of
                 A is not referenced.
                 Note that when  DIAG = 'U' or 'u', the diagonal elements of
                 A are not referenced either, but are assumed to be unity.
                 Unchanged on exit.
        LDA    - INTEGER.
                 On entry, LDA specifies the first dimension of A as declared
                 in the calling (sub) program. LDA must be at least
                 max( 1, n ).
                 Unchanged on exit.
        X      - DOUBLE PRECISION array of dimension at least
                 ( 1 + ( n - 1 )*abs( INCX ) ).
                 Before entry, the incremented array X must contain the n
                 element right-hand side vector b. On exit, X is overwritten
                 with the solution vector x.
        INCX   - INTEGER.
                 On entry, INCX specifies the increment for the elements of
                 X. INCX must not be zero.
                 Unchanged on exit.
        Level 2 Blas routine.

### Inputs

Name | Description
--- | ---
A[:, :] | Input matrix A
b[size(A, 2)] | Input vector b
upper | True if A is upper triangular
trans | True if op(A) means transposed(A)
unitTriangular | True if A is unit triangular, i.e. all diagonal elements of A are equal to 1

### Outputs

Name | Description
--- | ---
x[size(b, 1)] | Solution x

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dposv

Compute the solution to A * X = B, where A is a symmetric positive definite matrix

### Information

    Lapack documentation

        Purpose
        =======

        DPOSV computes the solution to a real system of linear equations
           A * X = B,
        where A is an N-by-N symmetric positive definite matrix and X and B
        are N-by-NRHS matrices.

        The Cholesky decomposition is used to factor A as
           A = U**T* U,  if UPLO = 'U', or
           A = L * L**T,  if UPLO = 'L',
        where U is an upper triangular matrix and L is a lower triangular
        matrix.  The factored form of A is then used to solve the system of
        equations A * X = B.

        Arguments
        =========

        UPLO    (input) CHARACTER*1
                = 'U':  Upper triangle of A is stored;
                = 'L':  Lower triangle of A is stored.

        N       (input) INTEGER
                The number of linear equations, i.e., the order of the
                matrix A.  N >= 0.

        NRHS    (input) INTEGER
                The number of right hand sides, i.e., the number of columns
                of the matrix B.  NRHS >= 0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the symmetric matrix A.  If UPLO = 'U', the leading
                N-by-N upper triangular part of A contains the upper
                triangular part of the matrix A, and the strictly lower
                triangular part of A is not referenced.  If UPLO = 'L', the
                leading N-by-N lower triangular part of A contains the lower
                triangular part of the matrix A, and the strictly upper
                triangular part of A is not referenced.

                On exit, if INFO = 0, the factor U or L from the Cholesky
                factorization A = U**T*U or A = L*L**T.

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).

        B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
                On entry, the N-by-NRHS right hand side matrix B.
                On exit, if INFO = 0, the N-by-NRHS solution matrix X.

        LDB     (input) INTEGER
                The leading dimension of the array B.  LDB >= max(1,N).

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value
                > 0:  if INFO = i, the leading minor of order i of A is not
                      positive definite, so the factorization could not be
                      completed, and the solution has not been computed.

        =====================================================================

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
A[:, size(A, 1)] | Real symmetric positive definite matrix A
B[size(A, 2), :] | Right hand side of A*X = B
upper | True if the upper triangle of A is provided

### Outputs

Name | Description
--- | ---
X[size(B, 1), size(B, 2)] | Solution of A*X = B
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dpocon

Estimates the reciprocal of the condition number (1-norm) of a real symmetric matrix A using the Cholesky factor

### Information

        Purpose
        =======

        DPOCON estimates the reciprocal of the condition number (in the
        1-norm) of a real symmetric positive definite matrix using the
        Cholesky factorization A = U**T*U or A = L*L**T computed by DPOTRF.

        An estimate is obtained for norm(inv(A)), and the reciprocal of the
        condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).

        Arguments
        =========

        UPLO    (input) CHARACTER*1
                = 'U':  Upper triangle of A is stored;
                = 'L':  Lower triangle of A is stored.

        N       (input) INTEGER
                The order of the matrix A.  N >= 0.

        A       (input) DOUBLE PRECISION array, dimension (LDA,N)
                The triangular factor U or L from the Cholesky factorization
                A = U**T*U or A = L*L**T, as computed by DPOTRF.

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,N).

        ANORM   (input) DOUBLE PRECISION
                The 1-norm (or infinity-norm) of the symmetric matrix A.

        RCOND   (output) DOUBLE PRECISION
                The reciprocal of the condition number of the matrix A,
                computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
                estimate of the 1-norm of inv(A) computed in this routine.

        WORK    (workspace) DOUBLE PRECISION array, dimension (3*N)

        IWORK   (workspace) INTEGER array, dimension (N)

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value

        =====================================================================

### Inputs

Name | Description
--- | ---
cholA[:, size(cholA, 1)] | Cholesky factor of matrix A
anorm | Norm of A
upper | Specifies whether A is upper or lower Cholesky factor

### Outputs

Name | Description
--- | ---
rcond | Reciprocal condition number of A
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dgelqf

Compute LQ factorization of a real matrix A=L*Q

### Information

        Purpose
        =======

        DGELQF computes an LQ factorization of a real M-by-N matrix A:
        A = L * Q.

        Arguments
        =========

        M       (input) INTEGER
                The number of rows of the matrix A.  M >= 0.

        N       (input) INTEGER
                The number of columns of the matrix A.  N >= 0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the M-by-N matrix A.
                On exit, the elements on and below the diagonal of the array
                contain the m-by-min(m,n) lower trapezoidal matrix L (L is
                lower triangular if m <= n); the elements above the diagonal,
                with the array TAU, represent the orthogonal matrix Q as a
                product of elementary reflectors (see Further Details).

        LDA     (input) INTEGER
                The leading dimension of the array A.  LDA >= max(1,M).

        TAU     (output) DOUBLE PRECISION array, dimension (min(M,N))
                The scalar factors of the elementary reflectors (see Further
                Details).

        WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
                On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

        LWORK   (input) INTEGER
                The dimension of the array WORK.  LWORK >= max(1,M).
                For optimum performance LWORK >= M*NB, where NB is the
                optimal blocksize.

                If LWORK = -1, then a workspace query is assumed; the routine
                only calculates the optimal size of the WORK array, returns
                this value as the first entry of the WORK array, and no error
                message related to LWORK is issued by XERBLA.

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument had an illegal value

        Further Details
        ===============

        The matrix Q is represented as a product of elementary reflectors

           Q = H(k) . . . H(2) H(1), where k = min(m,n).

        Each H(i) has the form

           H(i) = I - tau * v * v'

        where tau is a real scalar, and v is a real vector with
        v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n),
        and tau in TAU(i).

        =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] |

### Outputs

Name | Description
--- | ---
Aout[size(A, 1), size(A, 2)] | The lower triangle contains the m-min(m,n) lower trapezoidal matrix L, the elelments above contain the elementary reflectors
tau[min(size(A, 1), size(A, 2))] | Scalar factors of the elementary reflectors
info |

## Modelica_LinearSystems2.Math.Matrices.LAPACK.dorglq

Generate a matrix Q with orthonormal rows which is defined as the product of elementary reflectors, as returned by DGELQF

### Information

        Purpose
        =======

        DORGLQ generates an M-by-N real matrix Q with orthonormal rows,
        which is defined as the first M rows of a product of K elementary
        reflectors of order N

              Q  =  H(k) . . . H(2) H(1)

        as returned by DGELQF.

        Arguments
        =========

        M       (input) INTEGER
                The number of rows of the matrix Q. M >= 0.

        N       (input) INTEGER
                The number of columns of the matrix Q. N >= M.

        K       (input) INTEGER
                The number of elementary reflectors whose product defines the
                matrix Q. M >= K >= 0.

        A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                On entry, the i-th row must contain the vector which defines
                the elementary reflector H(i), for i = 1,2,...,k, as returned
                by DGELQF in the first k rows of its array argument A.
                On exit, the M-by-N matrix Q.

        LDA     (input) INTEGER
                The first dimension of the array A. LDA >= max(1,M).

        TAU     (input) DOUBLE PRECISION array, dimension (K)
                TAU(i) must contain the scalar factor of the elementary
                reflector H(i), as returned by DGELQF.

        WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
                On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

        LWORK   (input) INTEGER
                The dimension of the array WORK. LWORK >= max(1,M).
                For optimum performance LWORK >= M*NB, where NB is
                the optimal blocksize.

                If LWORK = -1, then a workspace query is assumed; the routine
                only calculates the optimal size of the WORK array, returns
                this value as the first entry of the WORK array, and no error
                message related to LWORK is issued by XERBLA.

        INFO    (output) INTEGER
                = 0:  successful exit
                < 0:  if INFO = -i, the i-th argument has an illegal value

        =====================================================================

### Inputs

Name | Description
--- | ---
A[:, :] | Orthogonal matrix of elementary reflectors
tau[:] | Scalar factors of the elementary reflectors

### Outputs

Name | Description
--- | ---
Q[size(A, 1), size(A, 2)] |
info |