@@ -270,15 +270,18 @@ def basis_evaluation(self, order, ps, entity=None, coordinate_mapping=None):
270
270
M = self .basis_transformation (coordinate_mapping )
271
271
# we expect M to be sparse with O(1) nonzeros per row
272
272
# for each row, get the column index of each nonzero entry
273
- csr = [[j for j in range (M .shape [1 ]) if not isinstance (M . array [i , j ], gem .Zero )]
273
+ csr = [[j for j in range (M .shape [1 ]) if not isinstance (M [i , j ], gem .Zero )]
274
274
for i in range (M .shape [0 ])]
275
275
276
276
def matvec (table ):
277
277
# basis recombination using hand-rolled sparse-dense matrix multiplication
278
- table = [gem .partial_indexed (table , (j ,)) for j in range (M .shape [1 ])]
278
+ ii = gem .indices (len (table .shape )- 1 )
279
+ phi = [gem .Indexed (table , (j , * ii )) for j in range (M .shape [1 ])]
279
280
# the sum approach is faster than calling numpy.dot or gem.IndexSum
280
- expressions = [sum (M .array [i , j ] * table [j ] for j in js ) for i , js in enumerate (csr )]
281
+ expressions = [gem .ComponentTensor (sum (M [i , j ] * phi [j ] for j in js ), ii )
282
+ for i , js in enumerate (csr )]
281
283
val = gem .ListTensor (expressions )
284
+ # val = M @ table
282
285
return gem .optimise .aggressive_unroll (val )
283
286
284
287
result = super ().basis_evaluation (order , ps , entity = entity )
0 commit comments