8000 Merge pull request #211 from KybernetikJo/numpydoc_math_py · python-control/Slycot@58df98f · GitHub
[go: up one dir, main page]

Skip to content

Commit 58df98f

Browse files
authored
Merge pull request #211 from KybernetikJo/numpydoc_math_py
Change math.py to numpydoc style
2 parents 70be09b + 91baf0e commit 58df98f

File tree

1 file changed

+78
-92
lines changed

1 file changed

+78
-92
lines changed

slycot/math.py

Lines changed: 78 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -137,80 +137,80 @@ def mb03rd(n, A, X=None, jobx='U', sort='N', pmax=1.0, tol=0.0):
137137
138138
Parameters
139139
----------
140-
n : int
141-
The order of the matrices `A` and `X`. `n` >= 0.
142-
A : (n, n) array_like
143-
The matrix `A` to be block-diagonalized, in real Schur form.
144-
X : (n, n) array_like, optional
145-
A given matrix `X`, for accumulation of transformations (only if
146-
`jobx`='U'). Default value is identity matrix of order `n`.
147-
jobx : {'N', 'U'}, optional
148-
Specifies whether or not the transformations are
149-
accumulated, as follows:
150-
151-
:= 'N': The transformations are not accumulated
152-
:= 'U': The transformations are accumulated in `Xr` (default)
153-
154-
sort : {'N', 'S', 'C', 'B'}, optional
155-
Specifies whether or not the diagonal blocks of the real
156-
Schur form are reordered, as follows:
157-
158-
:= 'N': The diagonal blocks are not reordered (default);
159-
:= 'S': The diagonal blocks are reordered before each
160-
step of reduction, so that clustered eigenvalues
161-
appear in the same block;
162-
:= 'C': The diagonal blocks are not reordered, but the
163-
"closest-neighbour" strategy is used instead of
164-
the standard "closest to the mean" strategy
165-
(see Notes_);
166-
:= 'B': The diagonal blocks are reordered before each
167-
step of reduction, and the "closest-neighbour"
168-
strategy is used (see Notes_).
169-
170-
pmax : float, optional
171-
An upper bound for the infinity norm of elementary
172-
submatrices of the individual transformations used for
173-
reduction (see Notes_). `pmax` >= 1.0
174-
tol : float, optional
175-
The tolerance to be used in the ordering of the diagonal
176-
blocks of the real Schur form matrix.
177-
If the user sets `tol` > 0, then the given value of `tol` is
178-
used as an absolute tolerance: a block `i` and a temporarily
179-
fixed block 1 (the first block of the current trailing
180-
submatrix to be reduced) are considered to belong to the
181-
same cluster if their eigenvalues satisfy
182-
183-
.. math:: | \\lambda_1 - \\lambda_i | <= tol.
184-
185-
If the user sets `tol` < 0, then the given value of tol is
186-
used as a relative tolerance: a block i and a temporarily
187-
fixed block 1 are considered to belong to the same cluster
188-
if their eigenvalues satisfy, for ``j = 1, ..., n``
189-
190-
.. math:: | \\lambda_1 - \\lambda_i | <= | tol | * \\max | \\lambda_j |.
191-
192-
If the user sets `tol` = 0, then an implicitly computed,
193-
default tolerance, defined by ``tol = SQRT( SQRT( EPS ) )``
194-
is used instead, as a relative tolerance, where `EPS` is
195-
the machine precision (see LAPACK Library routine DLAMCH).
196-
If `sort` = 'N' or 'C', this parameter is not referenced.
140+
n : int
141+
The order of the matrices `A` and `X`. `n` >= 0.
142+
A : (n, n) array_like
143+
The matrix `A` to be block-diagonalized, in real Schur form.
144+
X : (n, n) array_like, optional
145+
A given matrix `X`, for accumulation of transformations (only if
146+
`jobx`='U'). Default value is identity matrix of order `n`.
147+
jobx : {'N', 'U'}, optional
148+
Specifies whether or not the transformations are
149+
accumulated, as follows:
150+
151+
:= 'N': The transformations are not accumulated
152+
:= 'U': The transformations are accumulated in `Xr` (default)
153+
154+
sort : {'N', 'S', 'C', 'B'}, optional
155+
Specifies whether or not the diagonal blocks of the real
156+
Schur form are reordered, as follows:
157+
158+
:= 'N': The diagonal blocks are not reordered (default);
159+
:= 'S': The diagonal blocks are reordered before each
160+
step of reduction, so that clustered eigenvalues
161+
appear in the same block;
162+
:= 'C': The diagonal blocks are not reordered, but the
163+
"closest-neighbour" strategy is used instead of
164+
the standard "closest to the mean" strategy
165+
(see Notes_);
166+
:= 'B': The diagonal blocks are reordered before each
167+
step of reduction, and the "closest-neighbour"
168+
strategy is used (see Notes_).
169+
170+
pmax : float, optional
171+
An upper bound for the infinity norm of elementary
172+
submatrices of the individual transformations used for
173+
reduction (see Notes_). `pmax` >= 1.0
174+
tol : float, optional
175+
The tolerance to be used in the ordering of the diagonal
176+
blocks of the real Schur form matrix.
177+
If the user sets `tol` > 0, then the given value of `tol` is
178+
used as an absolute tolerance: a block `i` and a temporarily
179+
fixed block 1 (the first block of the current trailing
180+
submatrix to be reduced) are considered to belong to the
181+
same cluster if their eigenvalues satisfy
182+
183+
.. math:: | \\lambda_1 - \\lambda_i | <= tol.
184+
185+
If the user sets `tol` < 0, then the given value of tol is
186+
used as a relative tolerance: a block i and a temporarily
187+
fixed block 1 are considered to belong to the same cluster
188+
if their eigenvalues satisfy, for ``j = 1, ..., n``
189+
190+
.. math:: | \\lambda_1 - \\lambda_i | <= | tol | * \\max | \\lambda_j |.
191+
192+
If the user sets `tol` = 0, then an implicitly computed,
193+
default tolerance, defined by ``tol = SQRT( SQRT( EPS ) )``
194+
is used instead, as a relative tolerance, where `EPS` is
195+
the machine precision (see LAPACK Library routine DLAMCH).
196+
If `sort` = 'N' or 'C', this parameter is not referenced.
197197
198198
Returns
199199
-------
200-
Ar : (n, n) ndarray
201-
Contains the computed block-diagonal matrix, in real Schur
202-
canonical form. The non-diagonal blocks are set to zero.
203-
Xr : (n, n) ndarray or None
204-
Contains the product of the given matrix `X` and the
205-
transformation matrix that reduced `A` to block-diagonal
206-
form. The transformation matrix is itself a product of
207-
non-orthogonal similarity transformations having elements
208-
with magnitude less than or equal to `pmax`.
209-
If `jobx` = 'N', this array is returned as None
210-
blsize : (n,) ndarray
211-
The orders of the resulting diagonal blocks of the matrix `Ar`.
212-
W : (n,) complex ndarray
213-
Contains the complex eigenvalues of the matrix `A`.
200+
Ar : (n, n) ndarray
201+
Contains the computed block-diagonal matrix, in real Schur
202+
canonical form. The non-diagonal blocks are set to zero.
203+
Xr : (n, n) ndarray or None
204+
Contains the product of the given matrix `X` and the
205+
transformation matrix that reduced `A` to block-diagonal
206+
form. The transformation matrix is itself a product of
207+
non-orthogonal similarity transformations having elements
208+
with magnitude less than or equal to `pmax`.
209+
If `jobx` = 'N', this array is returned as None
210+
blsize : (n,) ndarray
211+
The orders of the resulting diagonal blocks of the matrix `Ar`.
212+
W : (n,) complex ndarray
213+
Contains the complex eigenvalues of the matrix `A`.
214214
215215
Notes
216216
-----
@@ -361,11 +361,9 @@ def mb03vd(n, ilo, ihi, A):
361361
362362
Parameters
363363
----------
364-
365364
n : int
366365
The order of the square matrices A_1, A_2, ..., A_p.
367366
n >= 0.
368-
369367
ilo, ihi : int
370368
It is assumed that all matrices A_j, j = 2, ..., p, are
371369
already upper triangular in rows and columns [:ilo-1] and
@@ -375,15 +373,12 @@ def mb03vd(n, ilo, ihi, A):
375373
If this is not the case, ilo and ihi should be set to 1
376374
and n, respectively.
377375
1 <= ilo <= max(1,n); min(ilo,n) <= ihi <= n.
378-
379376
A : ndarray
380377
A[:n,:n,:p] must contain the matrices of factors to be reduced;
381378
specifically, A[:,:,j-1] must contain A_j, j = 1, ..., p.
382379
383-
384380
Returns
385381
-------
386-
387382
HQ : ndarray
388383
3D array with same shape as A. The upper triangle and the first
389384
subdiagonal of HQ[:n,:n,0] contain the upper Hessenberg
@@ -396,16 +391,14 @@ def mb03vd(n, ilo, ihi, A):
396391
below the diagonal, with the j-th column of the array TAU
397392
represent the orthogonal matrix Q_j as a product of
398393
elementary reflectors. See FURTHER COMMENTS.
399-
400394
Tau : ndarray
401395
2D array with shape (max(1, n-1), p).
402396
The leading n-1 elements in the j-th column contain the
403397
scalar factors of the elementary reflectors used to form
404398
the matrix Q_j, j = 1, ..., p. See FURTHER COMMENTS.
405399
406-
Further Comments
407-
----------------
408-
400+
Notes
401+
-----
409402
Each matrix Q_j is represented as a product of (ihi-ilo)
410403
elementary reflectors,
411404
@@ -478,38 +471,31 @@ def mb03vy(n, ilo, ihi, A, Tau, ldwork=None):
478471
479472
Parameters
480473
----------
481-
482474
n : int
483475
The order of the matrices Q_1, Q_2, ..., Q_p. N >= 0.
484-
485476
ilo, ihi : int
486477
The values of the indices ilo and ihi, respectively, used
487478
in the previous call of the SLICOT Library routine MB03VD.
488479
1 <= ilo <= max(1,n); min(ilo,n) <= ihi <= n.
489-
490480
A : ndarray
491481
A[:n,:n,j-1] must contain the vectors which define the
492482
elementary reflectors used for reducing A_j, as returned
493483
by SLICOT Library routine MB03VD, j = 1, ..., p.
494-
495484
Tau : ndarray
496485
The leading N-1 elements in the j-th column must contain
497486
the scalar factors of the elementary reflectors used to
498487
form the matrix Q_j, as returned by SLICOT Library routine
499488
MB03VD.
500-
501489
ldwork : int, optional
502490
The length of the internal array DWORK. ldwork >= max(1, n).
503491
For optimum performance ldwork should be larger.
504492
505493
506494
Returns
507495
-------
508-
509496
Q : ndarray
510497
3D array with same shape as A. Q[:n,:n,j-1] contains the
511498
N-by-N orthogonal matrix Q_j, j = 1, ..., p.
512-
513499
"""
514500

515501
hidden = ' (hidden by the wrapper)'
@@ -561,7 +547,7 @@ def mb03wd(job, compz, n, ilo, ihi, iloz, ihiz, H, Q, ldwork=None):
561547
= 'E': Compute the eigenvalues only;
562548
= 'S': Compute the factors T_1, ..., T_p of the full
563549
Schur form, T = T_1*T_2*...*T_p.
564-
compz : {'N', 'I', 'V'}
550+
compz : {'N', 'I', 'V'}
565551
Indicates whether or not the user wishes to accumulate
566552
the matrices Z_1, ..., Z_p, as follows:
567553
= 'N': The matrices Z_1, ..., Z_p are not required;
@@ -776,9 +762,10 @@ def mb05nd(a, delta, tol=1e-7):
776762
Square matrix
777763
delta : float
778764
The scalar value delta of the problem.
779-
tol : float
780-
Tolerance. A good value is sqrt(eps)
781-
765+
tol : float, optional
766+
Tolerance. A good value is sqrt(eps).
767+
Default is 1e-7.
768+
782769
Returns
783770
-------
784771
F : (n, n) ndarray
@@ -831,7 +818,6 @@ def mc01td(dico, dp, p):
831818
832819
= 'C': continuous-time case;
833820
= 'D': discrete-time case.
834-
835821
dp : int
836822
The degree of the polynomial `P(x)`. ``dp >= 0``.
837823
p : (dp+1, ) array_like

0 commit comments

Comments
 (0)
0