Created
March 13, 2014 12:26
-
-
Save wence-/9527461 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/python/firedrake/nullspace.py b/python/firedrake/nullspace.py | |
| index 382f039..0daf197 100644 | |
| --- a/python/firedrake/nullspace.py | |
| +++ b/python/firedrake/nullspace.py | |
| @@ -1,5 +1,5 @@ | |
| from petsc4py import PETSc | |
| -from types import IndexedFunctionSpace | |
| +from types import IndexedFunctionSpace, Function | |
| class VectorSpaceBasis(object): | |
| @@ -38,10 +38,15 @@ class VectorSpaceBasis(object): | |
| return self._nullspace | |
| def orthogonalize(self, b): | |
| - """Orthogonalize ``b`` with respect to this :class:`.VectorSpaceBasis`. | |
| + """Return a copy of ``b`` orthogonalized with respect to this :class:`.VectorSpaceBasis`. | |
| :arg b: a :class:`.Function`""" | |
| - raise NotImplementedError | |
| + ret = Function(b) | |
| + with b.dat.vec_ro as bv: | |
| + for v, iv in zip(self._vecs, self._petsc_vecs): | |
| + dot = iv.dot(bv) | |
| + ret += -dot * v | |
| + return ret | |
| def is_orthonormal(self): | |
| """Is this vector space basis orthonormal?""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment