From dbe768cd254d93e35258baf185e95509d856f431 Mon Sep 17 00:00:00 2001 From: arsenovic Date: Sun, 7 Feb 2021 10:45:08 -0500 Subject: [PATCH] add randomMV and randomV to Multivector --- clifford/_multivector.py | 32 ++++++++++++++++++++++++++++++++ docs/conf.py | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/clifford/_multivector.py b/clifford/_multivector.py index 1790e059..7f1014bc 100644 --- a/clifford/_multivector.py +++ b/clifford/_multivector.py @@ -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. diff --git a/docs/conf.py b/docs/conf.py index 53323385..bbf98149 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,7 +53,7 @@ 'IPython.sphinxext.ipython_console_highlighting', #'numpydoc', 'sphinx.ext.viewcode', - #'sphinxcontrib.bibtex', + 'sphinxcontrib.bibtex', #'sphinx.ext.mathjax', ]