balance_method

wield.control.ss_bare.balance_method

Functions

balanceA(A, B, C, e[, permute, Dl, Dr])

Return a version of this statespace where A has been balanced for numerical stability.

balanceABC(A, B, C, e[, Bidx, Cidx, ...])

Return a version of this statespace where A has been balanced for numerical stability.

balanceABCE(A, B, C, E[, Bidx, Cidx, ...])

Return a version of this statespace where A, E has been balanced for numerical stability against B and C.

balanceAE(A, B, C, E[, permute, Dl, Dr])

Return a version of this statespace where A has been balanced for numerical stability.

float_round(arr[, num_bits, pos, round_choice])

Round floats to the nearest power of two.

topological_sort(A, B, C, e[, p])

Applies a topological sort to the matrix, to help ensure a clean conversion to Schur form.

uptri_sqrtm(U)

Create the square root of an upper triangular matrix.

Details

balanceA(A, B, C, e, permute=True, Dl=None, Dr=None)[source][github]

Return a version of this statespace where A has been balanced for numerical stability.

as_descriptor_ss : bool defaults False, will promote the statespace to descriptor form, as it forces left/right unequal balancing that will make E non-identity.

Dl and Dr are arrays for the left and right diagonal balancing (may not be inverses if treated as a descriptor system). This array should have length self.Nstates. It is modified in-place to report the balancing.

balanceABC(A, B, C, e, Bidx=None, Cidx=None, permute=True, Dl=None, Dr=None)[source][github]

Return a version of this statespace where A has been balanced for numerical stability.

Dl and Dr are arrays for the left and right diagonal balancing (may not be inverses if treated as a descriptor system). This array should have length self.Nstates. It is modified in-place to report the balancing.

balanceABCE(A, B, C, E, Bidx=None, Cidx=None, permute=True, Dl=None, Dr=None)[source][github]

Return a version of this statespace where A, E has been balanced for numerical stability against B and C.

Dl and Dr are arrays for the left and right diagonal balancing (may not be inverses if treated as a descriptor system). This array should have length self.Nstates. It is modified in-place to report the balancing.

balanceAE(A, B, C, E, permute=True, Dl=None, Dr=None)[source][github]

Return a version of this statespace where A has been balanced for numerical stability.

as_descriptor_ss : bool defaults False, will promote the statespace to descriptor form, as it forces left/right unequal balancing that will make E non-identity.

Dl and Dr are arrays for the left and right diagonal balancing (may not be inverses if treated as a descriptor system). This array should have length self.Nstates. It is modified in-place to report the balancing.

float_round(arr, num_bits=0, pos=True, round_choice=None)[source][github]

Round floats to the nearest power of two. Works on arrays.

Useful for noise-free (reversible) scaling of matrices.

round_choice is a function that takes the positive mantissa and returns a bool array whether to round down. Note that it doesn’t have to use its argument and could use some external data.

# TODO search for log2 in the sources and replace log2 methods with this one

topological_sort(A, B, C, e, p=None)[source][github]

Applies a topological sort to the matrix, to help ensure a clean conversion to Schur form.

uptri_sqrtm(U)[source][github]

Create the square root of an upper triangular matrix.

Uses the recursion relation on wikipedia

https://en.wikipedia.org/wiki/Square_root_of_a_matrix#Diagonal_and_triangular_matrices