From 39534f8fa0abb566028c956c65c4da28214bb23e Mon Sep 17 00:00:00 2001 From: Dhruv Kohli Date: Mon, 4 May 2026 05:37:57 -0700 Subject: [PATCH] Cast Utildeg to boolean after matrix multiplication C and Ug are boolean sparse matrices. On my end, scipy is resulting a matrix with int data type with summed values (treating True as ones) instead of OR. Casting into boolean dtype gives back OR-ed values. --- src/pyRATS/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyRATS/_utils.py b/src/pyRATS/_utils.py index fd2dd9c..e9a71fc 100644 --- a/src/pyRATS/_utils.py +++ b/src/pyRATS/_utils.py @@ -1072,7 +1072,7 @@ def compute_incidence_matrix_in_embedding(y, C, k, nu, metric="euclidean"): k_ = min(int(k * nu), n - 1) _, neigh_indg = nearest_neighbors(y, k_, metric) Ug = sparse_matrix(neigh_indg, np.ones(neigh_indg.shape, dtype=bool)) - Utildeg = C.dot(Ug) + Utildeg = C.dot(Ug).astype(bool) return Utildeg