Skip to content

Commit 4648d46

Browse files
committed
Fix #31
1 parent 3d982e2 commit 4648d46

File tree

6 files changed

+35
-3
lines changed

6 files changed

+35
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 0.9.8
2+
3+
* Fix #31: Remove ndim check from sparse vector ctypes wrapper to accommodate np.matrix arrays that can't be flattened
4+
15
### Version 0.9.7
26

37
* Fix #28: incorrect output when `out` is provided but the matrix multiplication is trivially all zeros

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools import setup, find_packages
33

44
DISTNAME = 'sparse_dot_mkl'
5-
VERSION = '0.9.7'
5+
VERSION = '0.9.8'
66
DESCRIPTION = "Intel MKL wrapper for sparse matrix multiplication"
77
MAINTAINER = 'Chris Jackson'
88
MAINTAINER_EMAIL = 'cj59@nyu.edu'

sparse_dot_mkl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.9.7'
1+
__version__ = '0.9.8'
22

33

44
from sparse_dot_mkl.sparse_dot import (

sparse_dot_mkl/_mkl_interface/_cfunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def _mv_argtypes(prec_type, _np_type):
631631
prec_type,
632632
sparse_matrix_t,
633633
matrix_descr,
634-
ndpointer(dtype=_np_type, ndim=1),
634+
ndpointer(dtype=_np_type),
635635
prec_type,
636636
ndpointer(dtype=_np_type),
637637
]

sparse_dot_mkl/_mkl_interface/_common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,14 @@ def _out_matrix(
914914

915915
# If there's no output array allocate a new array and return it
916916
if out_arr is None and initialize_zeros:
917+
debug_print(
918+
f"Allocating array {shape} ({order}) ({dtype})"
919+
)
917920
return _np.zeros(shape, dtype=dtype, order=order)
918921
elif out_arr is None:
922+
debug_print(
923+
f"Allocating array {shape} ({order}) ({dtype})"
924+
)
919925
return _np.ndarray(shape, dtype=dtype, order=order)
920926

921927
# Check and make sure the order is correct
@@ -963,6 +969,9 @@ def _out_matrix(
963969
)
964970

965971
else:
972+
debug_print(
973+
f"Using output array {shape} ({order}) ({dtype})"
974+
)
966975
return out_arr
967976

968977

sparse_dot_mkl/tests/test_scipy_classes.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import unittest
22
import numpy.testing as npt
33
import scipy as sp
4+
import numpy as np
45
import scipy.sparse as sps
56
from types import MethodType
67

@@ -48,6 +49,24 @@ def test_matmul(self):
4849
MATMUL
4950
)
5051

52+
def test_sum_0(self):
53+
54+
a = self.arr(MATRIX_1)
55+
56+
npt.assert_almost_equal(
57+
a.sum(axis=0),
58+
np.sum(a, axis=0)
59+
)
60+
61+
def test_sum_1(self):
62+
63+
a = self.arr(MATRIX_1)
64+
65+
npt.assert_almost_equal(
66+
a.sum(axis=1),
67+
np.sum(a, axis=1)
68+
)
69+
5170
def test_matmul_dense(self):
5271

5372
a = self.arr(MATRIX_1)

0 commit comments

Comments
 (0)