From a701c1e020f301ac3fbaff4cbf8b0bdb35412b98 Mon Sep 17 00:00:00 2001 From: Florian Huber <36473328+florian-huber@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:27:58 +0200 Subject: [PATCH] Update StackedSparseArray.py --- sparsestack/StackedSparseArray.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sparsestack/StackedSparseArray.py b/sparsestack/StackedSparseArray.py index 5db0662..453d438 100644 --- a/sparsestack/StackedSparseArray.py +++ b/sparsestack/StackedSparseArray.py @@ -1,13 +1,18 @@ # -*- coding: utf-8 -*- import numpy as np from scipy.sparse import coo_matrix -from scipy.sparse.sputils import get_index_dtype from .utils import join_arrays _slicing_not_implemented_msg = "Wrong slicing, or option not yet implemented" +def get_index_dtype(maxval): + if maxval <= np.iinfo(np.int32).max: + return np.int32 + return np.int64 + + class StackedSparseArray: """ 2.5D sparse matrix in COO-style with multiple possible entries per i-j-position.