This PR deletes type_utils.py; most functionality is no longer needed, and the two functions that were kept are moved to models/models_utils.py.
Details and comments
Details of what happened to the contents of type_utils.py:
The functions to_array, to_csr, to_BCOO, and to_numeric_matrix_type have been deleted, along with their tests.
A few tests throughout the package that were still using to_array unnecessarily have been changed.
ScipySparseVectorizedLindbladCollection in operator_collections.py still had a final use of to_csr to remove. I modified the vectorized lindblad classes to no longer need this function, and ended up translating a test case for to_csr handling of qutip Qobj types into a test case for unp.asarray.
The StateTypeConverter, along with its tests, have been completely deleted.
This class was originally written to handle a general type translation problem, but we didn't end up needing/using it, and in the end it was only used in a single location solvers/scipy_solve_ivp.py.
In light of the above, I've deleted the class and added a couple of much-simpler helper functions directly to solvers/scipy_solve_ivp.py.
The last remaining functions, vec_commutator and vec_dissipator, are only used in models/operator_collections.py. As such I've move type_utils.py -> models/models_utils.py.
Other changes:
Modified test_jax_transformations.py to no longer use Array.
All of the arraylias changes have led to slight modifications to how lists of CSR matrices are stored (internally, models store them as numpy object arrays with csr_matrix entries). When returned to a user, they used to return as a list of csr_matrix entries, but now they just return the numpy object array. As such I've had to modify code in a few places that expect a list. These are very minor and sprinkled throughout the package.
Test command (now we can just run all tests! :) ):
Summary
This PR deletes
type_utils.py
; most functionality is no longer needed, and the two functions that were kept are moved tomodels/models_utils.py
.Details and comments
Details of what happened to the contents of
type_utils.py
:to_array
,to_csr
,to_BCOO
, andto_numeric_matrix_type
have been deleted, along with their tests.to_array
unnecessarily have been changed.ScipySparseVectorizedLindbladCollection
inoperator_collections.py
still had a final use ofto_csr
to remove. I modified the vectorized lindblad classes to no longer need this function, and ended up translating a test case forto_csr
handling of qutip Qobj types into a test case forunp.asarray
.StateTypeConverter
, along with its tests, have been completely deleted.solvers/scipy_solve_ivp.py
.solvers/scipy_solve_ivp.py
.vec_commutator
andvec_dissipator
, are only used inmodels/operator_collections.py
. As such I've movetype_utils.py
->models/models_utils.py
.Other changes:
test_jax_transformations.py
to no longer useArray
.csr_matrix
entries). When returned to a user, they used to return as a list ofcsr_matrix
entries, but now they just return thenumpy
object array. As such I've had to modify code in a few places that expect a list. These are very minor and sprinkled throughout the package.Test command (now we can just run all tests! :) ):
The whole repo should now also pass linting.