symforce icon indicating copy to clipboard operation
symforce copied to clipboard

matrix.py operations not returning <class 'symforce.geo.matrix'> types

Open lowjunen opened this issue 3 years ago • 1 comments

I noticed that if I wanted to do jacobian after playing around with some matrix math, the output is a <class 'symengine.lib.symengine_wrapper.Add'> and not something like <class 'symforce.geo.matrix.Matrix31'>. To reproduce:

v1 = v.T*v
v2 = v.squared_norm()

dv1 = v1.jacobian(v)
dv2 = v2.jacobian(v)

dv2 will throw an error. Is this by design?

lowjunen avatar Jun 27 '22 23:06 lowjunen

v.squared_norm() will return a scalar type, so it has .diff() defined instead of .jacobian(). To make a vector, you can call geo.V1(v2). Does that help?

hayk-skydio avatar Jun 28 '22 03:06 hayk-skydio