pypose.cumops¶
- class pypose.cumops(input, dim, ops)[source]¶
Returns the cumulative user-defined operation of LieTensor along a dimension.
\[y_i = x_1~\mathrm{\circ}~x_2 ~\mathrm{\circ}~ \cdots ~\mathrm{\circ}~ x_i, \]where \(\mathrm{\circ}\) is the user-defined operation and \(x_i,~y_i\) are the \(i\)-th LieType item along the
dim
dimension of input and output, respectively.- Parameters
input (LieTensor) – the input LieTensor
dim (int) – the dimension to do the operation over
ops (func) – the user-defined operation or function
- Returns
LieTensor
- Return type
Note
The users are supposed to provide meaningful operation.
This function doesn’t check whether the results are valid for mathematical definition of LieTensor, e.g., quaternion.
The time complexity of the function is \(\mathcal{O}(\log N)\), where \(N\) is the LieTensor size along the
dim
dimension.
Examples
>>> input = pp.randn_SE3(2) >>> input.cumprod(dim = 0) SE3Type LieTensor: tensor([[-0.6466, 0.2956, 2.4055, -0.4428, 0.1893, 0.3933, 0.7833], [ 1.2711, 1.2020, 0.0651, -0.0685, 0.6732, 0.7331, -0.0685]]) >>> pp.cumops(input, 0, lambda a, b : a @ b) SE3Type LieTensor: tensor([[-0.6466, 0.2956, 2.4055, -0.4428, 0.1893, 0.3933, 0.7833], [ 1.2711, 1.2020, 0.0651, -0.0685, 0.6732, 0.7331, -0.0685]])