Skip to content

Commit

Permalink
rebase on main and update to support 1D CSR input
Browse files Browse the repository at this point in the history
  • Loading branch information
dschult committed May 8, 2024
1 parent c9557a5 commit 2390855
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 2 additions & 2 deletions scipy/sparse/_compressed.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def __init__(self, arg1, shape=None, dtype=None, copy=False):
except Exception as e:
raise ValueError(f"unrecognized {self.__class__.__name__} "
f"constructor input: {arg1}") from e
if isinstance(self, sparray) and arg1.ndim < 2 and self.format != "csr":
if isinstance(self, sparray) and arg1.ndim < 2 and self.format == "csc":
raise ValueError(
f"Non-CSR Compressed arrays don't take {arg1.ndim}D input. Use 2D"
f"CSC arrays don't support {arg1.ndim}D input. Use 2D"
)
coo = self._coo_container(arg1, dtype=dtype)
arrays = coo._coo_to_compressed(self._swap)
Expand Down
7 changes: 0 additions & 7 deletions scipy/sparse/tests/test_common1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ def test_no_1d_support_in_init(spcreator):
spcreator([0, 1, 2, 3])


# csr_array -- will soon support 1D
@pytest.mark.parametrize("spcreator", [csr_array])
def test_csr_init_of_1d(spcreator):
with pytest.raises(ValueError, match="arrays don't support 1D input yet"):
spcreator([0, 1, 2, 3])


# Main tests class
@pytest.mark.parametrize("spcreator", spcreators)
class TestCommon1D:
Expand Down

0 comments on commit 2390855

Please sign in to comment.