xfer_algorithms

wield.control.algorithms.statespace.dense.xfer_algorithms

Functions

array_solve_triangular(A, D, b[, E, sorz, ...])

Solve a triangular matrix system.

bdschur(a[, condmax, sort])

Block-diagonal Schur decomposition

blk_sizes2blk_tops(M, blk_sizes)

solve_sylvester_preschur(a, b, q)

Computes a solution (X) to the Sylvester equation \(AX + XB = Q\).

ss2response_laub(A, B, C, D[, E, sorz, ...])

Use Laub's method to calculate the frequency response.

ss2response_laub_bdschur(A, B, C, D[, E, ...])

this is a copy that tests out a bdschur method.

ss2response_laub_testing(A, B, C, D[, E, ...])

Use Laub's method to calculate the frequency response.

ss2response_mimo(A, B, C, D[, E, sorz])

ss2response_siso(A, B, C, D[, E, sorz, ...])

ss2xfer(A, B, C, D[, E, F_Hz, idx_in, idx_out])

Details

array_solve_triangular(A, D, b, E=None, sorz=None, blk_tops=None)[source][github]

Solve a triangular matrix system. A is a (M, M). D is (…, M) are broadcasted diagonals, and b is (M, N)

bdschur(a, condmax=None, sort=None)[source][github]

Block-diagonal Schur decomposition

Parameters:
  • a ((M, M) array_like) – Real matrix to decompose

  • condmax (None or float, optional) – If None (default), use 1/sqrt(eps), which is approximately 1e8

  • sort ({None, 'continuous', 'discrete'}) – Block sorting; see below.

Returns:

  • amodal ((M, M) real ndarray) – Block-diagonal Schur decomposition of a

  • tmodal ((M, M) real ndarray) – Similarity transform relating a and amodal

  • blksizes ((N,) int ndarray) – Array of Schur block sizes

Notes

If sort is None, the blocks are not sorted.

If sort is ‘continuous’, the blocks are sorted according to associated eigenvalues. The ordering is first by real part of eigenvalue, in descending order, then by absolute value of imaginary part of eigenvalue, also in decreasing order.

If sort is ‘discrete’, the blocks are sorted as for ‘continuous’, but applied to log of eigenvalues (i.e., continuous-equivalent eigenvalues).

Examples

>>> Gs = ct.tf2ss([1], [1, 3, 2])
>>> amodal, tmodal, blksizes = ct.bdschur(Gs.A)
>>> amodal                                                   
array([[-2.,  0.],
       [ 0., -1.]])
blk_sizes2blk_tops(M, blk_sizes)[source][github]
solve_sylvester_preschur(a, b, q)[source][github]

Computes a solution (X) to the Sylvester equation \(AX + XB = Q\).

Parameters:
  • a ((M, M) array_like) – Leading matrix of the Sylvester equation

  • b ((N, N) array_like) – Trailing matrix of the Sylvester equation

  • q ((M, N) array_like) – Right-hand side

Returns:

x – The solution to the Sylvester equation.

Return type:

(M, N) ndarray

Raises:

LinAlgError – If solution was not found

Notes

Computes a solution to the Sylvester matrix equation via the Bartels- Stewart algorithm. The A and B matrices first undergo Schur decompositions. The resulting matrices are used to construct an alternative Sylvester equation (RY + YS^T = F) where the R and S matrices are in quasi-triangular form (or, when R, S or F are complex, triangular form). The simplified equation is then solved using *TRSYL from LAPACK directly.

Added in version 0.11.0.

ss2response_laub(A, B, C, D, E=None, sorz=None, use_blocking=False, blocking_condmax=1000000000000.0)[source][github]

Use Laub’s method to calculate the frequency response. Very fast but in some cases less numerically stable. Generally OK if the A/E matrix has been balanced first.

TODO: Use the bdschur method or slycot mb03rd to further reduce the matrix size. Then enhance the back-substituion to do less work. In principle this can reduce the work from N^2 to N at every frequency point. That would be a massive speedup but would need numerical testing.

ss2response_laub_bdschur(A, B, C, D, E=None, sorz=None, use_blocking=False, blocking_condmax=1000000000000.0)[source][github]

this is a copy that tests out a bdschur method. TODO, extract this method

Use Laub’s method to calculate the frequency response. Very fast but in some cases less numerically stable. Generally OK if the A/E matrix has been balanced first.

TODO: Use the bdschur method or slycot mb03rd to further reduce the matrix size. Then enhance the back-substituion to do less work. In principle this can reduce the work from N^2 to N at every frequency point. That would be a massive speedup but would need numerical testing.

ss2response_laub_testing(A, B, C, D, E=None, sorz=None, use_blocking=False, blocking_condmax=1000000000000.0)[source][github]

Use Laub’s method to calculate the frequency response. Very fast but in some cases less numerically stable. Generally OK if the A/E matrix has been balanced first.

TODO: Use the bdschur method or slycot mb03rd to further reduce the matrix size. Then enhance the back-substituion to do less work. In principle this can reduce the work from N^2 to N at every frequency point. That would be a massive speedup but would need numerical testing.

ss2response_mimo(A, B, C, D, E=None, sorz=None)[source][github]
ss2response_siso(A, B, C, D, E=None, sorz=None, idx_in=None, idx_out=None)[source][github]
ss2xfer(A, B, C, D, E=None, F_Hz=None, idx_in=None, idx_out=None)[source][github]