Skip to content

Commit 76309ff

Browse files
authored
Merge pull request #188 from eric-wieser/fix-aliases
Fix the alias operator constructors on Ga objects
2 parents ccddb0a + 6e3a60c commit 76309ff

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

galgebra/ga.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,6 @@ def mv_x(self):
516516
def X(self):
517517
return self.mv(sum([coord*base for (coord, base) in zip(self.coords, self.basis)]))
518518

519-
def sdop(self, coefs, pdiffs=None):
520-
return mv.Sdop(coefs, pdiffs, ga=self)
521-
522519
def mv(self, root=None, *args, **kwargs):
523520
"""
524521
Instanciate and return a multivector for this, 'self',
@@ -527,7 +524,8 @@ def mv(self, root=None, *args, **kwargs):
527524
if root is None: # Return ga basis and compute grad and rgrad
528525
return self.mv_basis
529526

530-
kwargs['ga'] = self
527+
# ensure that ga is not already in kwargs
528+
kwargs = dict(ga=self, **kwargs)
531529

532530
if not utils.isstr(root):
533531
return mv.Mv(root, *args, **kwargs)
@@ -612,13 +610,17 @@ def grads(self):
612610
raise ValueError("Ga must have been initialized with coords to compute grads")
613611
return self.grad, self.rgrad
614612

613+
def pdop(self, *args, **kwargs):
614+
""" Shorthand to construct a :class:`~galgebra.mv.Pdop` for this algebra """
615+
return mv.Pdop(*args, ga=self, **kwargs)
616+
615617
def dop(self, *args, **kwargs):
616-
"""
617-
Instanciate and return a multivector differential operator for
618-
this, 'self', geometric algebra.
619-
"""
620-
kwargs['ga'] = self
621-
return mv.Dop(*args, **kwargs)
618+
""" Shorthand to construct a :class:`~galgebra.mv.Dop` for this algebra """
619+
return mv.Dop(*args, ga=self, **kwargs)
620+
621+
def sdop(self, *args, **kwargs):
622+
""" Shorthand to construct a :class:`~galgebra.mv.Sdop` for this algebra """
623+
return mv.Sdop(*args, ga=self, **kwargs)
622624

623625
def lt(self, *args, **kwargs):
624626
"""
@@ -629,17 +631,14 @@ def lt(self, *args, **kwargs):
629631
self._lt_flg = True
630632
(self.lt_coords, self.lt_x) = lt.Lt.setup(ga=self)
631633

632-
kwargs['ga'] = self
633-
return lt.Lt(*args, **kwargs)
634+
return lt.Lt(*args, ga=self, **kwargs)
634635

635636
def sm(self, *args, **kwargs):
636637
"""
637638
Instanciate and return a submanifold for this
638639
geometric algebra. See :class:`Sm` for instantiation inputs.
639640
"""
640-
kwargs['ga'] = self
641-
SM = Sm(*args, **kwargs)
642-
return SM
641+
return Sm(*args, ga=self, **kwargs)
643642

644643
def parametric(self, coords):
645644
if not isinstance(coords, list):
@@ -1710,9 +1709,6 @@ def blade_derivation(self, blade, ib):
17101709
self._dbases[key] = db
17111710
return db
17121711

1713-
def pdop(self,*args):
1714-
return mv.Pdop(args,ga=self)
1715-
17161712
def pDiff(self, A, coord):
17171713
"""
17181714
Compute partial derivative of multivector function 'A' with

0 commit comments

Comments
 (0)