pypose.cumprod¶
- class pypose.cumprod(input, dim, left=True)[source]¶
Returns the cumulative product (
@
) of LieTensor along a dimension.Left product:
\[y_i = x_i ~\times~ x_{i-1} ~\times~ \cdots ~\times~ x_1, \]Right product:
\[y_i = x_1 ~\times~ x_2 ~\times~ \cdots ~\times~ x_i, \]where \(\times\) denotes the group product (
@
), \(x_i,~y_i\) are the \(i\)-th item along thedim
dimension of the input and output LieTensor, respectively.- Parameters
- Returns
The LieTensor
- Return type
Note
The time complexity of the function is \(\mathcal{O}(\log N)\), where \(N\) is the LieTensor size along the
dim
dimension.
Example
Left product with \(\text{input} \in\)
SE3
>>> input = pp.randn_SE3(2) >>> pp.cumprod(input, dim=0) SE3Type LieTensor: tensor([[-1.9615, -0.1246, 0.3666, 0.0165, 0.2853, 0.3126, 0.9059], [ 0.7139, 1.3988, -0.1909, -0.1780, 0.4405, -0.6571, 0.5852]])
Right product with \(\text{input} \in\)
SO3
>>> input = pp.randn_SO3(1,2) >>> pp.cumprod(input, dim=1, left=False) SO3Type LieTensor: tensor([[[ 0.5798, -0.1189, -0.2429, 0.7686], [ 0.7515, -0.1920, 0.5072, 0.3758]]])