symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

Add more named Matrix types #223

Closed bradley-solliday-skydio closed 2 years ago

bradley-solliday-skydio commented 2 years ago

This commit was motivated by me wanting to be able to define a function for code generation which takes a 9x9 and 9x3 geo matrices as arguments.

Would have been convenient to simply specify the input types as sf.M99 and sf.M93, but these don't exist.

Could have done something like type(geo.M(9, 9)) or geo.matrix_type_from_shape((9, 9)), but that wouldn't pass the linter.

Perhaps a long term solution would be to have geo.Matrix subclass typing.Generic, but a number of issues would have to be worked out.

As a stop gap, I am simply extending our manual definitions for matrices from just being up to 6x6 matrices to 9x9 matrices.

aaron-skydio commented 2 years ago

Merged by 48699d1a2db43a8d0c71ec51f717a6a7a2737d3c