Check state-space matrices compatibility and ensure they are 2d arrays.
First, the input matrices are converted into two-dimensional arrays with
appropriate dtype as needed. Then the dimensions n, q, p are determined by
investigating the array shapes. If an input is None, or has size zero, it is
set to an array of zeros of compatible shape. Finally, it is verified that all
parameter shapes are compatible with each other. If that fails, a is
raised. Note that the dimensions n, q, p are allowed to be zero.
ValueError
Parameters:
A : array_like, optional
Two-dimensional array of shape (n, n).
B : array_like, optional
Two-dimensional array of shape (n, p).
C : array_like, optional
Two-dimensional array of shape (q, n).
D : array_like, optional
Two-dimensional array of shape (q, p).
Returns:
A, B, C, D : array
State-space matrices as two-dimensional arrays with identical dtype.
The result dtype is determined based on the standard
dtype promotion rules
except for when the inputs are all of integer dtype, in which case the returned
arrays will have the default floating point dtype of float64.
Raises:
ValueError
If the dimensions n, q, or p could not be determined or if the shapes are
incompatible with each other.
Notes
If a matrix is not modified, the original matrix (not a copy) is returned.
abcd_normalize has experimental support for Python Array API Standard compatible
backends in addition to NumPy. Please consider testing these features
by setting an environment variable SCIPY_ARRAY_API=1 and providing
CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following
combinations of backend and device (or other capability) are supported.
Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
✅
JAX
✅
✅
Dask
✅
n/a
The result dtype when all array inputs are of integer dtype is the
backend’s current default floating point dtype.