Skip to content

Commit 4be37e4

Browse files
ENH: make the Matrix class JSON serializable
1 parent 97b7734 commit 4be37e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rocketpy/mathutils/vector_matrix.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,10 @@ def __repr__(self):
10021002
+ f" [{self.zx}, {self.zy}, {self.zz}])"
10031003
)
10041004

1005+
def to_dict(self):
1006+
"""Returns the matrix as a JSON compatible element."""
1007+
return [list(row) for row in self.components]
1008+
10051009
@staticmethod
10061010
def identity():
10071011
"""Returns the 3x3 identity matrix."""

0 commit comments

Comments
 (0)