Skip to content

Commit

Permalink
Added unimodular to calculate unimodular part of a tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sad-Abd committed May 10, 2024
1 parent 73d42b8 commit 6f5d542
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/matadi/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,14 @@ def astensor(A, scale=1):

else:
raise ValueError("Unknown shape of input.")

def unimodular(T):
"""
Compute the unimodular part of a tensor.
The unimodular part of a tensor is a modified version of the tensor where
the determinant is raised to the power of (-1/3) and multiplied to the tensor.
This operation preserves the isochoric (volume-preserving) part of the tensor
while removing the volumetric part.
"""
return (det(T) ** (-1 / 3)) * T

0 comments on commit 6f5d542

Please sign in to comment.