From 8f558d72dbf2e8415f5e5883b0d1f7871f4f9cb8 Mon Sep 17 00:00:00 2001 From: EuGig Date: Sun, 3 Dec 2023 23:47:32 +0100 Subject: [PATCH 1/6] revered order of data/indices in dot --- sparse/_common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sparse/_common.py b/sparse/_common.py index 6073798b..73167a76 100644 --- a/sparse/_common.py +++ b/sparse/_common.py @@ -724,7 +724,11 @@ def _dot_csr_csr( sums[temp] = 0 indptr[i + 1] = nnz - return data, indices, indptr + + ordered_data = data[::-1] + ordered_indices = indices[::-1] + + return ordered_data, ordered_indices, indptr return _dot_csr_csr From 8b37195d556f2ea60858d12dc2d61c0f24d30ae6 Mon Sep 17 00:00:00 2001 From: EuGig Date: Mon, 4 Dec 2023 18:02:59 +0100 Subject: [PATCH 2/6] add tests to reversed indices --- sparse/._utils.py.swp | Bin 0 -> 36864 bytes sparse/_utils.py | 7 +++++++ sparse/tests/.test_dot.py.swp | Bin 0 -> 24576 bytes 3 files changed, 7 insertions(+) create mode 100644 sparse/._utils.py.swp create mode 100644 sparse/tests/.test_dot.py.swp diff --git a/sparse/._utils.py.swp b/sparse/._utils.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..628bdaacfeb0053bd9c94be2a1cba213b8922d51 GIT binary patch literal 36864 zcmeI53zTFb+bLoOwY{jf;#N1jLU)}GORnxx-u-yo$fm`m+iUT z^u4`1v&bU{)c8aYJZMx9P4F2X$5##{YJ7zF3W|!a81Zp1Cs7mQ@f^fQzP}##(cQBT zqA}6FXTR<4d#nDc`m1i;`m6rBGdr?l@?7(S^dp9~%0%z3NkkZ9Sn-@Z0l# z7&PXCc`uB83DEnn;i935pjBRIEc&4zmt()~R~w5#?9~IW9K=MuA}?^b4ow5?cy8$F#}wAD8`Zb^s^ZD&xW}G z`WonKps#_x2KpN4YoM=zz6Sal=xd;_fj>$Oc(p>|#77khyFk|eo&En4et!nu4X=i4 z;Yz4O1ug=Kb0N&YG^~POV}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cZQe>Z}pS<)`8+AN8T$eYu z$5bDu1n%c1 zER)p;W`O6`?X}~4X5l`QLXYPF(+!!h<{8AqkX_|Si!F1?2Yw5TREEu#{B?;47aINK zHSN}o(Ik{<2?uV1BjwS23v^A*3|-Q>GyJ>7OaBnsP_E&Q_H4ByxXfNyko?L~E}KNR zGk*1DdxR=2Hc)epe$uKv1siY02G!rq(i`MNLkRk9v?n64T zyiq%UulG91U%fDX8P;vKR2m)8z9z;ZX6F(IT#b`+kg$2*7l#25*TWgYjp|eToWK5d+>$c2v zD$OWjP?|U}Wp09l@?f$3-4+l~N{aV;+2OY;O!x66q=OPpOU<=*wmEa4)zRs5_nhnkV73 z>GBqSSx1*HF4NoVm@D_}yj|anc3szWF#Sn)`Exa}Voze~UW)RdI}%Ac+l81O#MIqy zA?qV6b%MW(tXqpY?IpVlm+6ZB7kaWZwFldCrCmU#qe_~K9lRV$FSQnlzuRuAckc2X zRAAsix+%_EuFE1j<`M7VkLdX95NEtQzC``2F7$t761SM literal 0 HcmV?d00001 diff --git a/sparse/_utils.py b/sparse/_utils.py index 3e199109..c61d0ca1 100644 --- a/sparse/_utils.py +++ b/sparse/_utils.py @@ -48,6 +48,13 @@ def assert_eq(x, y, check_nnz=True, compare_dtype=True, **kwargs): yy = y assert check_equal(xx, yy, **kwargs) + # tests for good slicing + assert np.array_equal(x[0].data, y[0]) + + # inverting indices and data to cause slicing error + x.indices = x.indices[::-1] + x.data = x.data[::-1] + assert not np.array_equal(x[0].data, y[0]) def assert_nnz(s, x): fill_value = s.fill_value if hasattr(s, "fill_value") else _zero_of_dtype(s.dtype) diff --git a/sparse/tests/.test_dot.py.swp b/sparse/tests/.test_dot.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..1a7a89cbb394c38247243638fe79e9cf62b1329e GIT binary patch literal 24576 zcmeI3d5k1g8Ndqx6&ICg1R?~=SvA#bZ*TW3yY5aHPJw`dHLTz<8QPkj+L?CyqN@gG zR6GN$NMfS#KvWKiKv1JZgct&76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Xr zk@om_An%i`v(}bbFbCtI@qxc2cAAuwoX1(;}Y|dm0GuSZ`O5U5&u_PtoHSo?8_yI zg_%va()qVu68Zd77@GeqILrLli6>mat6Q=Vf$fm z&>1R?#V)UEc(RWvOTOP>A5%6Ed7W!|#ui3GZ+fO$*}4@=rc$k9HObf3*;KKfV+&6u zN|HJKs2&ogR?ilk6V3gU+{xURU-t7aHrKKF?e~BlG7?6$a?&$x3&t{|yPWB4s<)}d zbKsu*XLg>g=l|Qj@8!nZg@Px*Di;Scpvy;@s{QNJ-zYDf&64TjM;R} zNv9X0VXv0uS0VL2SeU#JCX*#GH-=h9!)>(K9$D2cwp5dJPyNa+T9TAmOxW?SqsxAC z*_$hgB`}B0+HC7Xa_Te^Z>2brE&Ul)gs+P52a52sMP%=xlP;On#N1kCE++XB?J0R$ zny!YIBU24GThmFFe5rQD&yFIkxg=M%nc8AzS=S3w(#rT2B{^4HpXy3sQ!)UI4LZuE LwA%jH&B}iQ_*|1Q literal 0 HcmV?d00001 From 654f6cbd19586a349d250adb52d50b0354ab5419 Mon Sep 17 00:00:00 2001 From: EuGig Date: Mon, 4 Dec 2023 18:34:23 +0100 Subject: [PATCH 3/6] add tests and eliminate swap files --- sparse/._utils.py.swp | Bin 36864 -> 0 bytes sparse/tests/.test_dot.py.swp | Bin 24576 -> 0 bytes sparse/tests/test_dot.py | 1 - 3 files changed, 1 deletion(-) delete mode 100644 sparse/._utils.py.swp delete mode 100644 sparse/tests/.test_dot.py.swp diff --git a/sparse/._utils.py.swp b/sparse/._utils.py.swp deleted file mode 100644 index 628bdaacfeb0053bd9c94be2a1cba213b8922d51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36864 zcmeI53zTFb+bLoOwY{jf;#N1jLU)}GORnxx-u-yo$fm`m+iUT z^u4`1v&bU{)c8aYJZMx9P4F2X$5##{YJ7zF3W|!a81Zp1Cs7mQ@f^fQzP}##(cQBT zqA}6FXTR<4d#nDc`m1i;`m6rBGdr?l@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YpNBaw30w>eAs=l!@M7fso@mWi0Zr_4h` zgt?>0#2+147^mx+_)T&$^YUA!1Uvp{fy6E{wIT0b<^e&kswWM-%p#&ZJuW*rV)EAb z0?!3>ZYs5;k_?EewabLMY^-)U77C6GT2$&bFQNv;O|81nONjQcHufQd9y%5F05Af| z_WQD^Ib=pPjN=O~efjL_YLctAZZbXk91e_m_1IyE*yBcZQe>Z}pS<)`8+AN8T$eYu z$5bDu1n%c1 zER)p;W`O6`?X}~4X5l`QLXYPF(+!!h<{8AqkX_|Si!F1?2Yw5TREEu#{B?;47aINK zHSN}o(Ik{<2?uV1BjwS23v^A*3|-Q>GyJ>7OaBnsP_E&Q_H4ByxXfNyko?L~E}KNR zGk*1DdxR=2Hc)epe$uKv1siY02G!rq(i`MNLkRk9v?n64T zyiq%UulG91U%fDX8P;vKR2m)8z9z;ZX6F(IT#b`+kg$2*7l#25*TWgYjp|eToWK5d+>$c2v zD$OWjP?|U}Wp09l@?f$3-4+l~N{aV;+2OY;O!x66q=OPpOU<=*wmEa4)zRs5_nhnkV73 z>GBqSSx1*HF4NoVm@D_}yj|anc3szWF#Sn)`Exa}Voze~UW)RdI}%Ac+l81O#MIqy zA?qV6b%MW(tXqpY?IpVlm+6ZB7kaWZwFldCrCmU#qe_~K9lRV$FSQnlzuRuAckc2X zRAAsix+%_EuFE1j<`M7VkLdX95NEtQzC``2F7$t761SM diff --git a/sparse/tests/.test_dot.py.swp b/sparse/tests/.test_dot.py.swp deleted file mode 100644 index 1a7a89cbb394c38247243638fe79e9cf62b1329e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24576 zcmeI3d5k1g8Ndqx6&ICg1R?~=SvA#bZ*TW3yY5aHPJw`dHLTz<8QPkj+L?CyqN@gG zR6GN$NMfS#KvWKiKv1JZgct&76cq#`#0$mSL{#)2qp~jI?|VmGeeA42ysDGm^z^Im zU0=QT>ifR;YOZ?j>1VoID^-WjA&wJ%wH=)LzOV21nj;-2SXu}=&F(^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6Q=Vf$fm z&>1R?#V)UEc(RWvOTOP>A5%6Ed7W!|#ui3GZ+fO$*}4@=rc$k9HObf3*;KKfV+&6u zN|HJKs2&ogR?ilk6V3gU+{xURU-t7aHrKKF?e~BlG7?6$a?&$x3&t{|yPWB4s<)}d zbKsu*XLg>g=l|Qj@8!nZg@Px*Di;Scpvy;@s{QNJ-zYDf&64TjM;R} zNv9X0VXv0uS0VL2SeU#JCX*#GH-=h9!)>(K9$D2cwp5dJPyNa+T9TAmOxW?SqsxAC z*_$hgB`}B0+HC7Xa_Te^Z>2brE&Ul)gs+P52a52sMP%=xlP;On#N1kCE++XB?J0R$ zny!YIBU24GThmFFe5rQD&yFIkxg=M%nc8AzS=S3w(#rT2B{^4HpXy3sQ!)UI4LZuE LwA%jH&B}iQ_*|1Q diff --git a/sparse/tests/test_dot.py b/sparse/tests/test_dot.py index 214ff664..0a604d0e 100644 --- a/sparse/tests/test_dot.py +++ b/sparse/tests/test_dot.py @@ -74,7 +74,6 @@ def test_tensordot(a_shape, b_shape, axes, a_format, b_format): # tests for return_type=np.ndarray sa_sb = sparse.tensordot(sa, sb, axes, return_type=np.ndarray) - assert_eq(a_b, sa_sb) assert isinstance(sa_sb, np.ndarray) From a0c789dd6c1ec1733d570cafa87e0ad9627afdac Mon Sep 17 00:00:00 2001 From: EuGig Date: Mon, 4 Dec 2023 23:58:26 +0100 Subject: [PATCH 4/6] adding test function to test_dot.py --- sparse/tests/test_dot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sparse/tests/test_dot.py b/sparse/tests/test_dot.py index 0a604d0e..214ff664 100644 --- a/sparse/tests/test_dot.py +++ b/sparse/tests/test_dot.py @@ -74,6 +74,7 @@ def test_tensordot(a_shape, b_shape, axes, a_format, b_format): # tests for return_type=np.ndarray sa_sb = sparse.tensordot(sa, sb, axes, return_type=np.ndarray) + assert_eq(a_b, sa_sb) assert isinstance(sa_sb, np.ndarray) From 3b1c1b6d6db2269977f8096da0592598ff59c089 Mon Sep 17 00:00:00 2001 From: EuGig Date: Sat, 9 Dec 2023 13:41:47 +0100 Subject: [PATCH 5/6] fixes slicing bug and add tests --- sparse/_common.py | 11 ++++--- sparse/_utils.py | 28 ++++++++++++++---- sparse/tests/test_dot.py | 63 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 91 insertions(+), 11 deletions(-) diff --git a/sparse/_common.py b/sparse/_common.py index 73167a76..8b497f7b 100644 --- a/sparse/_common.py +++ b/sparse/_common.py @@ -725,10 +725,13 @@ def _dot_csr_csr( indptr[i + 1] = nnz - ordered_data = data[::-1] - ordered_indices = indices[::-1] - - return ordered_data, ordered_indices, indptr + if len(indices) == (n_col * n_row): + for i in range(len(indices) // n_col): + j = n_col * i + k = n_col * (1 + i) + data[j:k] = data[j:k][::-1] + indices[j:k] = indices[j:k][::-1] + return data, indices, indptr return _dot_csr_csr diff --git a/sparse/_utils.py b/sparse/_utils.py index c61d0ca1..d754b502 100644 --- a/sparse/_utils.py +++ b/sparse/_utils.py @@ -48,16 +48,32 @@ def assert_eq(x, y, check_nnz=True, compare_dtype=True, **kwargs): yy = y assert check_equal(xx, yy, **kwargs) - # tests for good slicing - assert np.array_equal(x[0].data, y[0]) - # inverting indices and data to cause slicing error - x.indices = x.indices[::-1] - x.data = x.data[::-1] - assert not np.array_equal(x[0].data, y[0]) +def assert_gcxs_slicing(s, x): + ''' + Util function to test slicing of GCXS matrices after product multiplication. + For simplicity, it tests only tensors with number of dimension = 3. + Parameters + ---------- + s: sparse product matrix + x: dense product matrix + ''' + row = np.random.randint(s.shape[s.ndim - 2]) + assert np.allclose(s[0][row].data, [num for num in x[0][row] if num != 0]) + + # regression test + col = s.shape[s.ndim - 1] + for i in range(len(s.indices) // col): + j = col * i + k = col * (1 + i) + s.data[j:k] = s.data[j:k][::-1] + s.indices[j:k] = s.indices[j:k][::-1] + assert np.array_equal(s[0][row].data, np.array([])) + def assert_nnz(s, x): fill_value = s.fill_value if hasattr(s, "fill_value") else _zero_of_dtype(s.dtype) + assert np.sum(~equivalent(x, fill_value)) == s.nnz diff --git a/sparse/tests/test_dot.py b/sparse/tests/test_dot.py index 214ff664..e7adaab0 100644 --- a/sparse/tests/test_dot.py +++ b/sparse/tests/test_dot.py @@ -7,7 +7,7 @@ import sparse from sparse._compressed import GCXS from sparse import COO -from sparse._utils import assert_eq +from sparse._utils import assert_eq, assert_gcxs_slicing @pytest.mark.parametrize( @@ -341,3 +341,64 @@ def test_dot_dense(dtype1, dtype2, ndim1, ndim2): assert_eq(sparse.matmul(a, b), np.matmul(a, b)) if ndim1 == 2 and ndim2 == 2: assert_eq(sparse.tensordot(a, b), np.tensordot(a, b)) + + +@pytest.mark.parametrize( + "a_shape, b_shape", + [((3, 4, 5), (5, 6)), ((2, 8, 6), (6, 3))], +) +def test_dot_GCXS_slicing(a_shape, b_shape): + sa = sparse.random(shape=a_shape, density=1, format="gcxs") + sb = sparse.random(shape=b_shape, density=1, format="gcxs") + + a = sa.todense() + b = sb.todense() + + # tests dot + sa_sb = sparse.dot(sa, sb) + a_b = np.dot(a, b) + + assert_gcxs_slicing(sa_sb, a_b) + + +@pytest.mark.parametrize( + "a_shape,b_shape,axes", + [ + [(3, 4, 5), (4, 3), (1, 0)], + [(3, 4), (5, 4, 3), (1, 1)], + [(5, 9), (9, 5, 6), (0, 1)], + ], +) +def test_tensordot_GCXS_slicing(a_shape, b_shape, axes): + sa = sparse.random(shape=a_shape, density=1, format="gcxs") + sb = sparse.random(shape=b_shape, density=1, format="gcxs") + + a = sa.todense() + b = sb.todense() + + sa_sb = sparse.tensordot(sa, sb, axes) + a_b = np.tensordot(a, b, axes) + + assert_gcxs_slicing(sa_sb, a_b) + + +@pytest.mark.parametrize( + "a_shape, b_shape", + [ + [(1, 1, 5), (3, 5, 6)], + [(3, 4, 5), (1, 5, 6)], + [(3, 4, 5), (3, 5, 6)], + [(3, 4, 5), (5, 6)], + ], +) +def test_matmul_GCXS_slicing(a_shape, b_shape): + sa = sparse.random(shape=a_shape, density=1, format="gcxs") + sb = sparse.random(shape=b_shape, density=1, format="gcxs") + + a = sa.todense() + b = sb.todense() + + sa_sb = sparse.matmul(sa, sb) + a_b = np.matmul(a, b) + + assert_gcxs_slicing(sa_sb, a_b) From b8e1818c4ae8d46749239fe3136eab5a2c74dd54 Mon Sep 17 00:00:00 2001 From: EuGig Date: Sat, 9 Dec 2023 14:05:41 +0100 Subject: [PATCH 6/6] fix slicing bug, add tests --- sparse/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sparse/_utils.py b/sparse/_utils.py index d754b502..82410412 100644 --- a/sparse/_utils.py +++ b/sparse/_utils.py @@ -50,14 +50,14 @@ def assert_eq(x, y, check_nnz=True, compare_dtype=True, **kwargs): def assert_gcxs_slicing(s, x): - ''' + """ Util function to test slicing of GCXS matrices after product multiplication. For simplicity, it tests only tensors with number of dimension = 3. Parameters ---------- s: sparse product matrix x: dense product matrix - ''' + """ row = np.random.randint(s.shape[s.ndim - 2]) assert np.allclose(s[0][row].data, [num for num in x[0][row] if num != 0])