You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scipy.sparse is moving to a new implementation, based on what they term sparse arrays rather than sparse matrices, see documentation for more information. As of now, it is unclear to which degree we will and should introduce the new format, but we should at least make the Ad framework ready for it.
Changes needed:
The AdArray class should be able to deal with sps.sparray and subclasses. My feeling is that this to a large degree is a question of replacing checks of the type if isinstance(mat, sps.spmatrix) to if isinstance(mat, (sps.spmatrix, sps.sparray)), but this should be checked.
Tests must be updated. In the first instance, the target should be the method test_arithmetic_operations_on_ad_objects() in tests/numerics/ad/test_operators.py, which should be rewritten to cover both sparse arrays and matrices. My first idea is to change the parametrization of this function to include both sparse_matrix (which replaces the current sparse) and sparse_array. Furthermore, the method to get hold of the matrix (current method _get_sparse_array()), should be invoked both for sparse arrays and matrices, but the wrapped array (line mat = sps.csr_matrix in _get_sparse_array) should be changed to mat = sps.csr_array when relevant.
It may be that further tweaks are needed, this will have to be seen.
The text was updated successfully, but these errors were encountered:
Scipy.sparse is moving to a new implementation, based on what they term sparse arrays rather than sparse matrices, see documentation for more information. As of now, it is unclear to which degree we will and should introduce the new format, but we should at least make the Ad framework ready for it.
Changes needed:
AdArray
class should be able to deal withsps.sparray
and subclasses. My feeling is that this to a large degree is a question of replacing checks of the typeif isinstance(mat, sps.spmatrix)
toif isinstance(mat, (sps.spmatrix, sps.sparray))
, but this should be checked.test_arithmetic_operations_on_ad_objects()
intests/numerics/ad/test_operators.py
, which should be rewritten to cover both sparse arrays and matrices. My first idea is to change the parametrization of this function to include bothsparse_matrix
(which replaces the currentsparse
) andsparse_array
. Furthermore, the method to get hold of the matrix (current method_get_sparse_array()
), should be invoked both for sparse arrays and matrices, but the wrapped array (linemat = sps.csr_matrix
in_get_sparse_array
) should be changed tomat = sps.csr_array
when relevant.It may be that further tweaks are needed, this will have to be seen.
The text was updated successfully, but these errors were encountered: