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
where _expm_multiply_simple_core(A, B, t_0, mu, m_star, s) returns a sparse matrix but X is a numpy matrix of type np.result_type(A.dtype, B.dtype, float) (In my case a float64) . So either the np.result_type function should have returned the type object to store the sparse matrices or in such cases _expm_multiply_simple_core(A, B, t_0, mu, m_star, s) should be transformed to a dense matrix.
The following works
expm_multiply(A, B)
without optional parameter (which is equivalent to_expm_multiply_simple(A, B)
)expm_multiply(A, B, start, stop, num)
wheretype(A) == numpy.ndarray
andtype(B) == scipy.sparse.csc.csc_matrix
type(A) == numpy.ndarray
andtype(B) == numpy.ndarray
The following fails
...and throws a
ValueError: setting an array element with a sequence
exception:expm_multiply(A, B, start, stop, num)
wheretype(A) == scipy.sparse.csc.csc_matrix
andtype(B) == numpy.ndarray
type(A) == scipy.sparse.csc.csc_matrix
andtype(B) == scipy.sparse.csc.csc_matrix
Example
Attempt to understand the problem
The traceback points to line 597 in scipy/scipy/sparse/linalg/_expm_multiply.py
where
_expm_multiply_simple_core(A, B, t_0, mu, m_star, s)
returns a sparse matrix butX
is a numpy matrix of typenp.result_type(A.dtype, B.dtype, float)
(In my case afloat64
) . So either thenp.result_type
function should have returned the typeobject
to store the sparse matrices or in such cases_expm_multiply_simple_core(A, B, t_0, mu, m_star, s)
should be transformed to a dense matrix.Scipy/Numpy/Python version information:
The text was updated successfully, but these errors were encountered: