Skip to content

Commit

Permalink
Explicit cast from matrix to array
Browse files Browse the repository at this point in the history
  • Loading branch information
asistradition committed Jul 2, 2024
1 parent 2cb7753 commit 5d60893
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sparse_dot_mkl/_mkl_interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ def _validate_dtype():
output_type='csr_matrix'
)

if not _np.allclose(test_comparison, final_array.todense()):
final_array = final_array.todense()

# Make sure this is an array and not np.matrix
try:
final_array = final_array.A
except AttributeError:
pass

if not _np.allclose(test_comparison, final_array):
raise ValueError("Match failed after matrix conversion")
_destroy_mkl_handle(csr_ref)
finally:
Expand Down

0 comments on commit 5d60893

Please sign in to comment.