Skip to content

Commit c681e36

Browse files
committed
numpy: add comments to the suitesparse tensor loader
1 parent 5cd350f commit c681e36

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy/util.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ def shiftLastMode(self, tensor):
196196
else:
197197
assert(False)
198198

199+
# ScipyMatrixMarketTensorLoader loads tensors in the matrix market format
200+
# into scipy.sparse matrices.
199201
class ScipyMatrixMarketTensorLoader:
200202
def __init__(self, format):
201203
self.format = format
@@ -209,6 +211,8 @@ def load(self, path):
209211
else:
210212
assert(False)
211213

214+
# PydataMatrixMarketTensorLoader loads tensors in the matrix market format
215+
# into pydata.sparse matrices.
212216
class PydataMatrixMarketTensorLoader:
213217
def __init__(self):
214218
pass
@@ -217,6 +221,7 @@ def load(self, path):
217221
coo = scipy.io.mmread(path)
218222
return sparse.COO.from_scipy_sparse(coo)
219223

224+
# SuiteSparseTensor represents a tensor in the suitesparse collection.
220225
class SuiteSparseTensor:
221226
def __init__(self, path):
222227
self.path = path
@@ -228,10 +233,12 @@ def __str__(self):
228233
def load(self, loader):
229234
return loader.load(self.path)
230235

236+
# TensorCollectionSuiteSparse represents the set of all downloaded
237+
# SuiteSparse tensors.
231238
class TensorCollectionSuiteSparse:
232239
def __init__(self):
233240
data = os.path.join(TENSOR_PATH, "suitesparse")
234-
sstensors= glob.glob(os.path.join(data, "*.mtx"))
241+
sstensors = glob.glob(os.path.join(data, "*.mtx"))
235242
self.tensors = [SuiteSparseTensor(t) for t in sstensors]
236243

237244
def getTensors(self):

0 commit comments

Comments
 (0)