Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 45
Implement MB02ED#214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Implement MB02ED #214
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
84c9552
mb02ed
saasaa 05fd0b7
fix formatting
saasaa d373407
added numpydoc style docstring
saasaa 15188ef
fixed typos in docstring
saasaa bad3c74
Added new test, added checking of input variables
saasaa 7c14647
Merge branch 'python-control:master' into master
saasaa 3a97769
remove checks in wrapper
saasaa da77ca9
changed Warns to Raises in docstring
saasaa 7da2c4c
remove unused import
saasaa 56609fc
Update docstring, fix checks in signature,
saasaa bf0d133
remove checks in signature
saasaa eb93764
Apply suggestions from code review
saasaa 05797af
update docstring
saasaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,6 +23,107 @@ | ||
| import numpy as np | ||
| def mb02ed(typet: str, T: np.ndarray, B: np.ndarray, n: int, k: int, nrhs: int): | ||
| """ X, T = mb02ed(typet, T, B, n, k, nrhs) | ||
| Solve a system of linear equations T*X = B or X*T = B with a positive | ||
| definite block Toeplitz matrix T. | ||
| Parameters | ||
| ---------- | ||
| typet: str | ||
| Specifies the type of T: | ||
| - 'R': T contains the first block row of an s.p.d. block Toeplitz matrix, | ||
| and the system X*T = B is solved. | ||
| - 'C': T contains the first block column of an s.p.d. block Toeplitz matrix, | ||
| and the system T*X = B is solved. | ||
| Note: the notation x / y means that x corresponds to | ||
| typet = 'R' and y corresponds to typet = 'C'. | ||
| T : array_like | ||
| The leading k-by-n*k / n*k-by-k part of this array must contain the first | ||
| block row/column of an s.p.d. block Toeplitz matrix. | ||
| B : array_like | ||
| The leading nrhs-by-n*k / n*k-by-nrhs part of this array must contain the | ||
| right-hand side matrix B. | ||
| n : int | ||
| The number of blocks in T. n >= 0. | ||
| k : int | ||
| The number of rows/columns in T, equal to the blocksize. k >= 0. | ||
| nrhs : int | ||
| The number of right-hand sides. nrhs >= 0. | ||
| Returns | ||
| ------- | ||
| X : ndarray | ||
saasaa marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Leading nrhs-by-n*k / n*k-by-nrhs part of | ||
| this array contains the solution matrix X. | ||
| T: ndarray | ||
| If no error is thrown and nrhs > 0, then the leading | ||
| k-by-n*k / n*k-by-k part of this array contains the last | ||
| row / column of the Cholesky factor of inv(T). | ||
| Raises | ||
| ------ | ||
| SlycotArithmeticError | ||
| :info = 1: | ||
| The reduction algorithm failed. The Toeplitz matrix associated | ||
| with T is not numerically positive definite. | ||
| SlycotParameterError | ||
| :info = -1: | ||
| typet must be either "R" or "C" | ||
| :info = -2: | ||
| k must be >= 0 | ||
| :info = -3: | ||
| n must be >= 0 | ||
| :info = -4: | ||
| nrhs must be >= 0 | ||
| Notes | ||
| ----- | ||
| The algorithm uses Householder transformations, modified hyperbolic rotations, | ||
| and block Gaussian eliminations in the Schur algorithm [1], [2]. | ||
| References | ||
| ---------- | ||
| [1] Kailath, T. and Sayed, A. | ||
| Fast Reliable Algorithms for Matrices with Structure. | ||
| SIAM Publications, Philadelphia, 1999. | ||
| [2] Kressner, D. and Van Dooren, P. | ||
| Factorizations and linear system solvers for matrices with Toeplitz structure. | ||
| SLICOT Working Note 2000-2, 2000. | ||
| Numerical Aspects | ||
| ----------------- | ||
| The implemented method is numerically equivalent to forming the Cholesky factor R and the | ||
| inverse Cholesky factor of T using the generalized Schur algorithm and solving the systems | ||
| of equations R*X = L*B or X*R = B*L by a blocked backward substitution algorithm. | ||
| The algorithm requires O(K * N^2 + K * N * NRHS) floating-point operations. | ||
| """ | ||
| hidden = " (hidden by the wrapper)" | ||
| arg_list = [ | ||
| "typet", | ||
| "k", | ||
| "n", | ||
| "nrhs", | ||
| "t", | ||
| "ldt" + hidden, | ||
| "b", | ||
| "ldb" + hidden, | ||
| "ldwork" + hidden, | ||
| "dwork" + hidden, | ||
| "info", | ||
| ] | ||
| T, X, info = _wrapper.mb02ed(typet=typet, k=k, n=n, nrhs=nrhs, t=T, b=B) | ||
| raise_if_slycot_error(info, arg_list, docstring=mb02ed.__doc__, checkvars=locals()) | ||
| return X, T | ||
| def mb03rd(n, A, X=None, jobx='U', sort='N', pmax=1.0, tol=0.0): | ||
| """Ar, Xr, blsize, W = mb03rd(n, A, [X, jobx, sort, pmax, tol]) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.