The following code
import numpy as np
from pydrake.all import InitializeAutoDiffTuple
x = np.array([1,2,3])
y = np.array([4,5,6])
np.cross(x,y)
(x_ad,y_ad) = InitializeAutoDiffTuple(x, y)
np.cross(x_ad, y_ad)
Leads to the error
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-f44901f6fd4e> in <module>
----> 1 np.cross(x_ad, y_ad)
<__array_function__ internals> in cross(*args, **kwargs)
~/.local/lib/python3.8/site-packages/numpy/core/numeric.py in cross(a, b, axisa, axisb, axisc, axis)
1604 "(dimension must be 2 or 3)")
1605 if a.shape[-1] not in (2, 3) or b.shape[-1] not in (2, 3):
-> 1606 raise ValueError(msg)
1607
1608 # Create the output array
ValueError: incompatible dimensions for cross product
(dimension must be 2 or 3)
Does Drake AutoDiffXd not support numpy's cross product?