@@ -196,6 +196,8 @@ def shiftLastMode(self, tensor):
196
196
else :
197
197
assert (False )
198
198
199
+ # ScipyMatrixMarketTensorLoader loads tensors in the matrix market format
200
+ # into scipy.sparse matrices.
199
201
class ScipyMatrixMarketTensorLoader :
200
202
def __init__ (self , format ):
201
203
self .format = format
@@ -209,6 +211,8 @@ def load(self, path):
209
211
else :
210
212
assert (False )
211
213
214
+ # PydataMatrixMarketTensorLoader loads tensors in the matrix market format
215
+ # into pydata.sparse matrices.
212
216
class PydataMatrixMarketTensorLoader :
213
217
def __init__ (self ):
214
218
pass
@@ -217,6 +221,7 @@ def load(self, path):
217
221
coo = scipy .io .mmread (path )
218
222
return sparse .COO .from_scipy_sparse (coo )
219
223
224
+ # SuiteSparseTensor represents a tensor in the suitesparse collection.
220
225
class SuiteSparseTensor :
221
226
def __init__ (self , path ):
222
227
self .path = path
@@ -228,10 +233,12 @@ def __str__(self):
228
233
def load (self , loader ):
229
234
return loader .load (self .path )
230
235
236
+ # TensorCollectionSuiteSparse represents the set of all downloaded
237
+ # SuiteSparse tensors.
231
238
class TensorCollectionSuiteSparse :
232
239
def __init__ (self ):
233
240
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" ))
235
242
self .tensors = [SuiteSparseTensor (t ) for t in sstensors ]
236
243
237
244
def getTensors (self ):
0 commit comments