Skip to content

Commit

Permalink
ENH: make the Matrix class JSON serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Oct 9, 2024
1 parent 97b7734 commit 4be37e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rocketpy/mathutils/vector_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,10 @@ def __repr__(self):
+ f" [{self.zx}, {self.zy}, {self.zz}])"
)

def to_dict(self):
"""Returns the matrix as a JSON compatible element."""
return [list(row) for row in self.components]

@staticmethod
def identity():
"""Returns the 3x3 identity matrix."""
Expand Down

0 comments on commit 4be37e4

Please sign in to comment.