@@ -165,41 +165,12 @@ namespace pinocchio
165165 return res;
166166 }
167167
168- // / [CRBA] MatrixBase operator* (Constraint::Transpose S, ForceSet::Block)
169- template <typename Derived>
170- Eigen::Matrix<
171- Scalar,
172- 3 ,
173- Derived::ColsAtCompileTime,
174- Options | Eigen::RowMajor,
175- 3 ,
176- Derived::MaxColsAtCompileTime>
177- operator *(const Eigen::MatrixBase<Derived> & F) const
168+ template <typename ForceSet>
169+ typename ConstraintForceSetOp<JointMotionSubspaceEllipsoidTpl, ForceSet>::ReturnType
170+ operator *(const Eigen::MatrixBase<ForceSet> & F)
178171 {
179- EIGEN_STATIC_ASSERT (
180- Derived::RowsAtCompileTime == 6 , THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
181- typedef Eigen::Matrix<
182- Scalar, 3 , Derived::ColsAtCompileTime, Options | Eigen::RowMajor, 3 ,
183- Derived::MaxColsAtCompileTime>
184- ReturnType;
185-
186- ReturnType res (3 , F.cols ());
187-
188- // First two rows: S[:, 0:2]^T * F
189- res.template topRows <2 >().noalias () =
190- ref.S .template leftCols <2 >().transpose () * F.derived ();
191-
192- // Third row: [0,0,0,0,0,1]^T · F = F.row(5)
193- res.row (2 ) = F.row (5 );
194-
195- return res;
172+ return ref.S .transpose () * F.derived ();
196173 }
197- // template<typename ForceSet>
198- // typename ConstraintForceSetOp<JointMotionSubspaceTpl, ForceSet>::ReturnType
199- // operator*(const Eigen::MatrixBase<ForceSet> & F)
200- // {
201- // return ref.S.transpose() * F.derived();
202- // }
203174 }; // struct TransposeConst
204175
205176 TransposeConst transpose () const
@@ -292,8 +263,8 @@ namespace pinocchio
292263
293264 /* [CRBA] ForceSet operator* (Inertia Y, Constraint S) */
294265 template <typename S1, int O1, typename S2, int O2>
295- Eigen::Matrix<S1, 6 , 3 , O1> operator *(
296- const InertiaTpl<S1, O1> & Y, const JointMotionSubspaceEllipsoidTpl<S2, O2> & S)
266+ Eigen::Matrix<S1, 6 , 3 , O1>
267+ operator *( const InertiaTpl<S1, O1> & Y, const JointMotionSubspaceEllipsoidTpl<S2, O2> & S)
297268 {
298269 // none of this work at this stage: I'll squash after the review to make the code disappear.
299270 // // Y * S where last col is [0,0,0,0,0,1]^T (rotation around z-axis)
@@ -311,9 +282,11 @@ namespace pinocchio
311282 // // Column 2: Y * [0,0,0,0,0,1]^T = Y.matrix().col(5)
312283 // M.col(2) = Y_mat.col(Inertia::ANGULAR + 2);
313284 typedef Eigen::Matrix<S1, 6 , 3 , O1> ReturnType;
314- ReturnType M;
315- M.noalias () = Y.matrix () * S.matrix ();
316- return M;
285+ // ReturnType M;
286+ // M.noalias() = Y.matrix() * S.matrix();
287+ ReturnType res (6 , S.nv ());
288+ motionSet::inertiaAction (Y, S.S , res);
289+ return res;
317290 }
318291
319292 /* [ABA] Y*S operator (Matrix6 Y, Constraint S) */
@@ -325,7 +298,7 @@ namespace pinocchio
325298 const Eigen::MatrixBase<Matrix6Like> & Y, const JointMotionSubspaceEllipsoidTpl<S2, O2> & S)
326299 {
327300 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE (Matrix6Like, 6 , 6 );
328- return Y. derived () * S.matrix () ;
301+ return Y * S.S ;
329302 }
330303
331304 template <typename _Scalar, int _Options>
0 commit comments