Skip to content

Commit

Permalink
add randomMV and randomV to Multivector
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenovic committed Feb 7, 2021
1 parent 045b006 commit dbe768c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions clifford/_multivector.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,38 @@ def conjugate(self) -> 'MultiVector':
"""
return (~self).gradeInvol()

def randomMV(self,*args, **kw):
'''
create a random MV within space of self
This is a wrapper for `randomMV`
See Also
---------
Layout.randomMV
randomMV
'''
if not self.isBlade():
raise ValueError('I must be a blade')
return cf.randomMV(layout=self.layout, *args, **kw)(self)

def randomV(self,*args, **kw):
'''
create a random MV within space of self
This is a wrapper for `Layout.randomMV`
See Also
---------
Layout.randomMV
'''
if not self.isBlade():
raise ValueError('I must be a blade')
kw.update(grades=[1])
return cf.randomMV(layout=self.layout, *args, **kw)(self)



# Subspace operations
def project(self, other) -> 'MultiVector':
r"""Projects the multivector onto the subspace represented by this blade.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'IPython.sphinxext.ipython_console_highlighting',
#'numpydoc',
'sphinx.ext.viewcode',
#'sphinxcontrib.bibtex',
'sphinxcontrib.bibtex',

#'sphinx.ext.mathjax',
]
Expand Down

0 comments on commit dbe768c

Please sign in to comment.