@@ -475,6 +475,108 @@ def ab08nd(n,m,p,A,B,C,D,equil='N',tol=0,ldwork=None):
475475 raise e
476476 return out [:- 1 ]
477477
478+ def ab08nz (n , m , p , A , B , C , D , equil = 'N' , tol = 0. , lzwork = None ):
479+ """ nu,rank,dinfz,nkror,nkrol,infz,kronr,kronl,Af,Bf = ab08nz(n,m,p,A,B,C,D,[equil,tol,lzwork])
480+
481+ To construct for a linear multivariable system described by a state-space
482+ model (A,B,C,D) a regular pencil (Af - lambda*Bf ) which has the invariant
483+ zeros of the system as generalized eigenvalues.
484+ The routine also computes the orders of the infinite zeros and the
485+ right and left Kronecker indices of the system (A,B,C,D).
486+
487+ Required arguments:
488+ n : input int
489+ The number of state variables. n >= 0.
490+ m : input int
491+ The number of system inputs. m >= 0.
492+ p : input int
493+ The number of system outputs. p >= 0.
494+ A : input rank-2 array('d') with bounds (n,n)
495+ The leading n-by-n part of this array must contain the state
496+ dynamics matrix A of the system.
497+ B : input rank-2 array('d') with bounds (n,m)
498+ The leading n-by-m part of this array must contain the input/state
499+ matrix B of the system.
500+ C : input rank-2 array('d') with bounds (p,n)
501+ The leading p-by-n part of this array must contain the state/output
502+ matrix C of the system.
503+ D : input rank-2 array('d') with bounds (p,m)
504+ The leading p-by-m part of this array must contain the direct
505+ transmission matrix D of the system.
506+ Optional arguments:
507+ equil := 'N' input string(len=1)
508+ Specifies whether the user wishes to balance the compound matrix
509+ as follows:
510+ = 'S': Perform balancing (scaling);
511+ = 'N': Do not perform balancing.
512+ tol := 0.0 input float
513+ A tolerance used in rank decisions to determine the effective rank,
514+ which is defined as the order of the largest leading (or trailing)
515+ triangular submatrix in the QR (or RQ) factorization with column
516+ (or row) pivoting whose estimated condition number is less than 1/tol.
517+ lzwork := None input int
518+ The length of the cache array zwork. The default value is calculated
519+ to MAX( 1, MIN(P,M) + MAX(3*M-1,N),
520+ MIN(P,N) + MAX(3*P-1,N+P,N+M),
521+ MIN(M,N) + MAX(3*M-1,N+M) )
522+ for optimum performance should be larger.
523+ Return objects:
524+ nu : int
525+ The number of (finite) invariant zeros.
526+ rank : int
527+ The normal rank of the transfer function matrix.
528+ dinfz : int
529+ The maximum degree of infinite elementary divisors.
530+ nkror : int
531+ The number of right Kronecker indices.
532+ nkrol : int
533+ The number of left Kronecker indices.
534+ infz : rank-1 array('i') with bounds (n)
535+ The leading dinfz elements of infz contain information on the
536+ infinite elementary divisors as follows: the system has infz(i)
537+ infinite elementary divisors of degree i, where i = 1,2,...,dinfz.
538+ kronr : rank-1 array('i') with bounds (max(n,m)+1)
539+ the leading nkror elements of this array contain the right kronecker
540+ (column) indices.
541+ kronl : rank-1 array('i') with bounds (max(n,p)+1)
542+ the leading nkrol elements of this array contain the left kronecker
543+ (row) indices.
544+ Af : rank-2 array('d') with bounds (max(1,n+m),n+min(p,m))
545+ the leading nu-by-nu part of this array contains the coefficient
546+ matrix Af of the reduced pencil. the remainder of the leading
547+ (n+m)-by-(n+min(p,m)) part is used as internal workspace.
548+ Bf : rank-2 array('d') with bounds (max(1,n+p),n+m)
549+ The leading nu-by-nu part of this array contains the coefficient
550+ matrix Bf of the reduced pencil. the remainder of the leading
551+ (n+p)-by-(n+m) part is used as internal workspace.
552+ lzwork_opt : int
553+ The optimal value of lzwork.
554+ """
555+ hidden = ' (hidden by the wrapper)'
556+ arg_list = ['equil' , 'n' , 'm' , 'p' ,
557+ 'a' , 'lda' + hidden , 'b' , 'ldb' + hidden ,
558+ 'c' , 'ldc' + hidden , 'd' , 'ldd' + hidden ,
559+ 'nu' , 'rank' , 'dinfz' , 'nkror' , 'nkrol' , 'infz' , 'kronr' ,
560+ 'kronl' , 'af' , 'ldaf' + hidden , 'bf' , 'ldbf' + hidden ,
561+ 'tol' , 'iwork' + hidden , 'dwork' + hidden , 'zwork' ,
562+ 'lzwork' , 'info' ]
563+ if lzwork is None :
564+ lzwork = max (min (p , m ) + max (3 * m - 1 , n ),
565+ min (p , n ) + max (3 * p - 1 , n + p , n + m ),
566+ min (m , n ) + max (3 * m - 1 , n + m ))
567+ out = _wrapper .ab08nz (n , m , p , A , B , C , D ,
568+ equil = equil , tol = tol , lzwork = lzwork )
569+ nu , rank , dinfz , nkror , nkrol , infz , kronr , kronl , Af , Bf , zwork , info \
570+ = out
571+ if info < 0 :
572+ error_text = "The following argument had an illegal value: " + \
573+ arg_list [info - 1 ]
574+ e = ValueError (error_text )
575+ e .info = info
576+ raise e
577+ return (nu , rank , dinfz , nkror , nkrol , infz , kronr , kronl , Af , Bf ,
578+ int (zwork [0 ].real ))
579+
478580def ab09ad (dico ,job ,equil ,n ,m ,p ,A ,B ,C ,nr = None ,tol = 0 ,ldwork = None ):
479581 """ nr,Ar,Br,Cr,hsv = ab09ad(dico,job,equil,n,m,p,A,B,C,[nr,tol,ldwork])
480582
@@ -729,7 +831,7 @@ def ab09ax(dico,job,n,m,p,A,B,C,nr=None,tol=0.0,ldwork=None):
729831
730832def ab09bd (dico ,job ,equil ,n ,m ,p ,A ,B ,C ,D ,nr = None ,tol1 = 0 ,tol2 = 0 ,ldwork = None ):
731833 """ nr,Ar,Br,Cr,Dr,hsv = ab09bd(dico,job,equil,n,m,p,A,B,C,D,[nr,tol1,tol2,ldwork])
732-
834+
733835 To compute a reduced order model (Ar,Br,Cr,Dr) for a stable
734836 original state-space representation (A,B,C,D) by using either the
735837 square-root or the balancing-free square-root Singular
@@ -912,7 +1014,7 @@ def ab09md(dico,job,equil,n,m,p,A,B,C,alpha=None,nr=None,tol=0,ldwork=None):
9121014 The number of system outputs. p >= 0.
9131015 A : input rank-2 array('d'), dimension (n,n)
9141016 On entry, the leading N-by-N part of this array must
915- contain the state dynamics matrix A.
1017+ contain the state dynamics matrix A.
9161018 B : input rank-2 array('d'), dimension (n,m)
9171019 On entry, the leading N-by-M part of this array must
9181020 contain the original input/state matrix B.
@@ -1056,7 +1158,7 @@ def ab09md(dico,job,equil,n,m,p,A,B,C,alpha=None,nr=None,tol=0,ldwork=None):
10561158
10571159def ab09nd (dico ,job ,equil ,n ,m ,p ,A ,B ,C ,D ,alpha = None ,nr = None ,tol1 = 0 ,tol2 = 0 ,ldwork = None ):
10581160 """ nr,Ar,Br,Cr,Dr,ns,hsv = ab09nd(dico,job,equil,n,m,p,A,B,C,D,[alpha,nr,tol1,tol2,ldwork])
1059-
1161+
10601162 To compute a reduced order model (Ar,Br,Cr,Dr) for an original
10611163 state-space representation (A,B,C,D) by using either the
10621164 square-root or the balancing-free square-root Singular
@@ -1574,23 +1676,23 @@ def ag08bd(l,n,m,p,A,E,B,C,D,equil='N',tol=0.0,ldwork=None):
15741676 """ Af,Ef,nrank,niz,infz,kronr,infe,kronl = ag08bd(l,n,m,p,A,E,B,C,D,[equil,tol,ldwork])
15751677
15761678 To extract from the system pencil
1577-
1679+
15781680 ( A-lambda*E B )
15791681 S(lambda) = ( )
15801682 ( C D )
1581-
1683+
15821684 a regular pencil Af-lambda*Ef which has the finite Smith zeros of
15831685 S(lambda) as generalized eigenvalues. The routine also computes
15841686 the orders of the infinite Smith zeros and determines the singular
15851687 and infinite Kronecker structure of system pencil, i.e., the right
15861688 and left Kronecker indices, and the multiplicities of infinite
15871689 eigenvalues.
1588-
1690+
15891691 Required arguments:
15901692 l : input int
15911693 The number of rows of matrices A, B, and E. l >= 0.
15921694 n : input int
1593- The number of columns of matrices A, E, and C. n >= 0.
1695+ The number of columns of matrices A, E, and C. n >= 0.
15941696 m : input int
15951697 The number of columns of matrix B. m >= 0.
15961698 p : input int
@@ -1658,10 +1760,10 @@ def ag08bd(l,n,m,p,A,E,B,C,D,equil='N',tol=0.0,ldwork=None):
16581760 """
16591761 hidden = ' (hidden by the wrapper)'
16601762 arg_list = ['equil' , 'l' , 'n' , 'm' , 'p' , 'A' , 'lda' + hidden , 'E' , 'lde' + hidden , 'B' , 'ldb' + hidden , 'C' , 'ldc' + hidden , 'D' , 'ldd' + hidden , 'nfz' , 'nrank' , 'niz' , 'dinfz' , 'nkror' , 'ninfe' , 'nkrol' , 'infz' , 'kronr' , 'infe' , 'kronl' , 'tol' , 'iwork' + hidden , 'dwork' + hidden , 'ldwork' , 'info' ]
1661-
1763+
16621764 if equil != 'S' and equil != 'N' :
16631765 raise ValueError ('Parameter equil had an illegal value' )
1664-
1766+
16651767 if ldwork is None :
16661768 ldw = max (l + p ,m + n )* (m + n ) + max (1 ,5 * max (l + p ,m + n ))
16671769 if equil == 'S' :
0 commit comments