Skip to content
Snippets Groups Projects
Verified Commit c5d1a348 authored by Marcus Mohr's avatar Marcus Mohr
Browse files

Make code for AffineMap2D more elegant and expressive

parent aacf835a
Branches
No related tags found
1 merge request!40Add support for bubble enhanced P2 element in 2D
Pipeline #74767 passed with warnings
......@@ -620,19 +620,10 @@ class AffineMap2D(GeometryMap):
return False
def evaluate(self, x: sp.Matrix) -> sp.Matrix:
xnew = sp.zeros(2, 1)
xnew[0] = self.mat[0, 0] * x[0] + self.mat[0, 1] * x[1] + self.vec[0]
xnew[1] = self.mat[1, 0] * x[0] + self.mat[1, 1] * x[1] + self.vec[1]
return xnew
return self.mat * x + self.vec
def jacobian(self, x: sp.Matrix) -> sp.Matrix:
jac = sp.Matrix(
[
[self.mat[0, 0], self.mat[0, 1]],
[self.mat[1, 0], self.mat[1, 1]],
]
)
jac = self.mat.copy()
return jac
def hessian(self, x: sp.Matrix) -> List[sp.Matrix]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment