pwrs.corex.validation#
Runtime normalization helpers for typed core inputs.
- pwrs.corex.validation.as_float_matrix(value, *, name='value')[source]#
Convert an input to a two-dimensional floating-point matrix.
- Parameters:
value (object)
name (str)
- Return type:
FloatArray
- pwrs.corex.validation.as_float_scalar(value, *, name='value')[source]#
Convert a scalar-like value to
floatand reject non-scalars.- Parameters:
value (object)
name (str)
- Return type:
float
- pwrs.corex.validation.as_complex_vector(value, *, name='value')[source]#
Convert an input to a one-dimensional complex vector.
- Parameters:
value (object)
name (str)
- Return type:
ComplexArray
- pwrs.corex.validation.as_index_vector(value, *, name='value', one_based=True)[source]#
Convert an index input to an integer vector and validate its domain.
- Parameters:
value (object)
name (str)
one_based (bool)
- Return type:
IntArray
- pwrs.corex.validation.as_dense_matrix(value)[source]#
Return a dense representation without leaking SciPy’s untyped API.
- Parameters:
value (Matrix)
- Return type:
DenseMatrix
- pwrs.corex.validation.as_csc_matrix(value)[source]#
Normalize a value to a CSC matrix behind the SciPy typing boundary.
- Parameters:
value (object)
- Return type:
- pwrs.corex.validation.as_csr_matrix(value)[source]#
Normalize a value to a CSR matrix behind the SciPy typing boundary.
- Parameters:
value (object)
- Return type:
- pwrs.corex.validation.matrix_real(value)[source]#
Return the real part of a dense or sparse matrix.
- Parameters:
value (Matrix)
- Return type:
Matrix
- pwrs.corex.validation.matrix_imag(value)[source]#
Return the imaginary part of a dense or sparse matrix.
- Parameters:
value (Matrix)
- Return type:
Matrix
- pwrs.corex.validation.subtract_matrices(left, right)[source]#
Subtract matrices while preserving sparse storage when needed.
- Parameters:
left (Matrix)
right (Matrix)
- Return type:
Matrix