1717from typing import List
1818
1919import lxml .etree as ET
20- import scipy .sparse as sp
2120
2221from openmc .checkvalue import check_type , check_greater_than , PathLike
2322from openmc .data import gnds_name , zam
2423from openmc .exceptions import DataError
2524from .nuclide import FissionYieldDistribution , Nuclide
2625from .._xml import get_text
26+ from .._sparse_compat import csc_array , dok_array
2727import openmc .data
2828
2929
@@ -619,7 +619,7 @@ def form_matrix(self, rates, fission_yields=None):
619619
620620 Returns
621621 -------
622- scipy.sparse.csc_matrix
622+ scipy.sparse.csc_array
623623 Sparse matrix representing depletion.
624624
625625 See Also
@@ -713,7 +713,7 @@ def setval(i, j, val):
713713 reactions .clear ()
714714
715715 # Return CSC representation instead of DOK
716- return sp . csc_matrix ((vals , (rows , cols )), shape = (n , n ))
716+ return csc_array ((vals , (rows , cols )), shape = (n , n ))
717717
718718 def add_redox_term (self , matrix , buffer , oxidation_states ):
719719 r"""Adds a redox term to the depletion matrix from data contained in
@@ -731,7 +731,7 @@ def add_redox_term(self, matrix, buffer, oxidation_states):
731731
732732 Parameters
733733 ----------
734- matrix : scipy.sparse.csc_matrix
734+ matrix : scipy.sparse.csc_array
735735 Sparse matrix representing depletion
736736 buffer : dict
737737 Dictionary of buffer nuclides used to maintain anoins net balance.
@@ -743,7 +743,7 @@ def add_redox_term(self, matrix, buffer, oxidation_states):
743743 states as integers (e.g., +1, 0).
744744 Returns
745745 -------
746- matrix : scipy.sparse.csc_matrix
746+ matrix : scipy.sparse.csc_array
747747 Sparse matrix with redox term added
748748 """
749749 # Elements list with the same size as self.nuclides
@@ -769,7 +769,7 @@ def add_redox_term(self, matrix, buffer, oxidation_states):
769769 for nuc , idx in buffer_idx .items ():
770770 array [idx ] -= redox_change * buffer [nuc ] / os [idx ]
771771
772- return sp . csc_matrix (array )
772+ return csc_array (array )
773773
774774 def form_rr_term (self , tr_rates , current_timestep , mats ):
775775 """Function to form the transfer rate term matrices.
@@ -800,13 +800,13 @@ def form_rr_term(self, tr_rates, current_timestep, mats):
800800
801801 Returns
802802 -------
803- scipy.sparse.csc_matrix
803+ scipy.sparse.csc_array
804804 Sparse matrix representing transfer term.
805805
806806 """
807807 # Use DOK as intermediate representation
808808 n = len (self )
809- matrix = sp . dok_matrix ((n , n ))
809+ matrix = dok_array ((n , n ))
810810
811811 for i , nuc in enumerate (self .nuclides ):
812812 elm = re .split (r'\d+' , nuc .name )[0 ]
@@ -857,15 +857,15 @@ def form_ext_source_term(self, ext_source_rates, current_timestep, mat):
857857
858858 Returns
859859 -------
860- scipy.sparse.csc_matrix
860+ scipy.sparse.csc_array
861861 Sparse vector representing external source term.
862862
863863 """
864864 if not ext_source_rates .get_components (mat , current_timestep ):
865865 return
866866 # Use DOK as intermediate representation
867867 n = len (self )
868- vector = sp . dok_matrix ((n , 1 ))
868+ vector = dok_array ((n , 1 ))
869869
870870 for i , nuc in enumerate (self .nuclides ):
871871 # Build source term vector
0 commit comments