We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4876400 commit 3a20dc2Copy full SHA for 3a20dc2
src/rapids_singlecell/preprocessing/_sparse_pca/_helper.py
@@ -39,13 +39,14 @@ def _compute_cov(
39
40
def _check_matrix_for_zero_genes(X: spmatrix) -> None:
41
gene_ex = cp.zeros(X.shape[1], dtype=cp.int32)
42
- _spca.check_zero_genes(
43
- X.indices.data.ptr,
44
- gene_ex.data.ptr,
45
- int(X.nnz),
46
- int(X.shape[1]),
47
- int(cp.cuda.get_current_stream().ptr),
48
- )
+ if X.nnz > 0:
+ _spca.check_zero_genes(
+ int(X.indices.data.ptr),
+ int(gene_ex.data.ptr),
+ int(X.nnz),
+ int(X.shape[1]),
+ int(cp.cuda.get_current_stream().ptr),
49
+ )
50
if cp.any(gene_ex == 0):
51
raise ValueError(
52
"There are genes with zero expression. Please remove them before running PCA."
0 commit comments