本文整理汇总了C++中MatrixX::block方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixX::block方法的具体用法?C++ MatrixX::block怎么用?C++ MatrixX::block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixX
的用法示例。
在下文中一共展示了MatrixX::block方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
const typename
Type<Scalar>::MatrixX& HumanoidLipComJerkMinimizationObjective<Scalar>::getHessian()
{
assert(feetSupervisor_.getNbSamples() == lipModel_.getNbSamples());;
int N = lipModel_.getNbSamples();
int M = feetSupervisor_.getNbPreviewedSteps();
int nb = feetSupervisor_.getNbOfCallsBeforeNextSample() - 1;
const LinearDynamic<Scalar>& dynCopX = lipModel_.getCopXLinearDynamic(nb);
const LinearDynamic<Scalar>& dynCopY = lipModel_.getCopYLinearDynamic(nb);
MatrixX tmp = MatrixX::Zero(2*N, 2*N + 2*M);
tmp.block(0, 0, 2*N, 2*N) = feetSupervisor_.getRotationMatrixT();
tmp.block(0, 2*N, N, M) = feetSupervisor_.getFeetPosLinearDynamic().U;
tmp.block(N, 2*N + M, N, M) = feetSupervisor_.getFeetPosLinearDynamic().U;
MatrixX tmp2 = MatrixX::Zero(2*N, 2*N);
const MatrixX& weight = feetSupervisor_.getSampleWeightMatrix();
tmp2.block(0, 0, N, N) = dynCopX.UTinv*weight*dynCopX.Uinv;
tmp2.block(N, N, N, N) = dynCopY.UTinv*weight*dynCopY.Uinv;
hessian_.noalias() = tmp.transpose()*tmp2*tmp;
return hessian_;
}
示例2: run_test
void run_test(int dim, int num_elements)
{
using std::abs;
typedef typename internal::traits<MatrixType>::Scalar Scalar;
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
typedef Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
// MUST be positive because in any other case det(cR_t) may become negative for
// odd dimensions!
const Scalar c = abs(internal::random<Scalar>());
MatrixX R = randMatrixSpecialUnitary<Scalar>(dim);
VectorX t = Scalar(50)*VectorX::Random(dim,1);
MatrixX cR_t = MatrixX::Identity(dim+1,dim+1);
cR_t.block(0,0,dim,dim) = c*R;
cR_t.block(0,dim,dim,1) = t;
MatrixX src = MatrixX::Random(dim+1, num_elements);
src.row(dim) = Matrix<Scalar, 1, Dynamic>::Constant(num_elements, Scalar(1));
MatrixX dst = cR_t*src;
MatrixX cR_t_umeyama = umeyama(src.block(0,0,dim,num_elements), dst.block(0,0,dim,num_elements));
const Scalar error = ( cR_t_umeyama*src - dst ).norm() / dst.norm();
VERIFY(error < Scalar(40)*std::numeric_limits<Scalar>::epsilon());
}