@@ -1000,10 +1000,7 @@ def components(self):
10001000 (coefs , bases ) = metric .linear_expand (self .obj )
10011001 cb = list (zip (coefs , bases ))
10021002 cb = sorted (cb , key = lambda x : self .Ga ._all_blades_lst .index (x [1 ]))
1003- terms = []
1004- for (coef , base ) in cb :
1005- terms .append (self .Ga .mv (coef * base ))
1006- return terms
1003+ return [self .Ga .mv (coef * base ) for (coef , base ) in cb ]
10071004
10081005 def get_coefs (self , grade ):
10091006 (coefs , bases ) = metric .linear_expand (self .obj )
@@ -1343,19 +1340,16 @@ def simplify(self, modes=simplify):
13431340 def subs (self , d ):
13441341 # For each scalar coef of the multivector apply substitution argument d
13451342 (coefs , bases ) = metric .linear_expand (self .obj )
1346- obj = S ( 0 )
1347- for ( coef , base ) in zip (coefs , bases ):
1348- obj += coef . subs ( d ) * base
1343+ obj = sum ((
1344+ coef . subs ( d ) * base for coef , base in zip (coefs , bases )
1345+ ), S ( 0 ))
13491346 return Mv (obj , ga = self .Ga )
13501347
13511348 def expand (self ):
1352- coefs ,bases = metric .linear_expand (self .obj )
1353- new_coefs = []
1354- for coef in coefs :
1355- new_coefs .append (expand (coef ))
1356- obj = S (0 )
1357- for coef ,base in zip (new_coefs ,bases ):
1358- obj += coef * base
1349+ coefs , bases = metric .linear_expand (self .obj )
1350+ obj = sum ((
1351+ expand (coef ) * base for coef , base in zip (coefs , bases )
1352+ ), S (0 ))
13591353 return Mv (obj , ga = self .Ga )
13601354
13611355 def list (self ):
@@ -1449,10 +1443,9 @@ def setGa(ga):
14491443 return
14501444
14511445 def TSimplify (self ):
1452- new_terms = []
1453- for (coef , pdiff ) in self .terms :
1454- new_terms .append ((metric .Simp .apply (coef ), pdiff ))
1455- return Sdop (new_terms , ga = self .Ga )
1446+ return Sdop ([
1447+ (metric .Simp .apply (coef ), pdiff ) for (coef , pdiff ) in self .terms
1448+ ], ga = self .Ga )
14561449
14571450 @staticmethod
14581451 def consolidate_coefs (sdop ):
@@ -2041,13 +2034,10 @@ def simplify(self, modes=simplify):
20412034 """
20422035 Simplify each multivector coefficient of a partial derivative
20432036 """
2044- new_coefs = []
2045- new_pd = []
2046- for (coef , pd ) in self .terms :
2047- tmp = coef .simplify (modes = modes )
2048- new_coefs .append (tmp )
2049- new_pd .append (pd )
2050- return Dop (new_coefs , new_pd , ga = self .Ga , cmpflg = self .cmpflg )
2037+ return Dop (
2038+ [(coef .simplify (modes = modes ), pd ) for coef , pd in self .terms ],
2039+ ga = self .Ga , cmpflg = self .cmpflg
2040+ )
20512041
20522042 def consolidate_coefs (self ):
20532043 """
@@ -2192,10 +2182,9 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's
21922182 return product
21932183
21942184 def TSimplify (self ):
2195- new_terms = []
2196- for (coef , pdiff ) in self .terms :
2197- new_terms .append ((metric .Simp .apply (coef ), pdiff ))
2198- return Dop (new_terms , ga = self .Ga )
2185+ return Dop ([
2186+ (metric .Simp .apply (coef ), pdiff ) for (coef , pdiff ) in self .terms
2187+ ], ga = self .Ga )
21992188
22002189 def __truediv__ (self , dopr ):
22012190 if isinstance (dopr , (Dop , Mv )):
0 commit comments