本文整理汇总了C++中eigen::VectorXf::block方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorXf::block方法的具体用法?C++ VectorXf::block怎么用?C++ VectorXf::block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::VectorXf
的用法示例。
在下文中一共展示了VectorXf::block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
static void
solve(struct PdSolver *solver, Eigen::VectorXf const &b)
{
float const epsilon = 1e-6f;
float error = 1.0f;
uint32_t iters = 0;
Eigen::VectorXf x_prev = solver->positions_last;
while (error > epsilon * epsilon || iters < 2) {
#pragma omp parallel for
for (uint32_t i = 0; i < solver->m; ++i) {
Eigen::VectorXf y = b.block(i*solver->block_n, 0, solver->block_n, 1);
SolverT &lu = solver->blocks[i];
for (uint32_t j = 0; j < solver->n; ++j) {
if (i != j); else continue;
y -= solver->a_mat.block(i*solver->block_m, j*solver->block_n, solver->block_m, solver->block_n)
* x_prev.block(j * solver->block_n, 0, solver->block_n, 1);
}
solver->positions.block(i*solver->block_n, 0, solver->block_n, 1) = lu.solve(y);
}
x_prev = solver->positions;
error = (b - solver->a_mat * x_prev).squaredNorm();
++iters;
}
solver->block_jacobi_iters = iters;
solver->block_jacobi_err = std::sqrt(error);
}