10 #warning "OpenMP is not available. Parallel reduction will be disabled."
20 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud,
typename TargetTree,
typename CorrespondenceRejector,
typename Factor>
21 std::tuple<Eigen::Matrix<double, 6, 6>, Eigen::Matrix<double, 6, 1>,
double>
linearize(
22 const TargetPointCloud& target,
23 const SourcePointCloud& source,
24 const TargetTree& target_tree,
25 const CorrespondenceRejector& rejector,
26 const Eigen::Isometry3d& T,
27 std::vector<Factor>& factors)
const {
28 std::vector<Eigen::Matrix<double, 6, 6>> Hs(
num_threads, Eigen::Matrix<double, 6, 6>::Zero());
29 std::vector<Eigen::Matrix<double, 6, 1>> bs(
num_threads, Eigen::Matrix<double, 6, 1>::Zero());
32 #pragma omp parallel for num_threads(num_threads) schedule(guided, 8)
33 for (std::int64_t i = 0; i < factors.size(); i++) {
34 Eigen::Matrix<double, 6, 6> H;
35 Eigen::Matrix<double, 6, 1> b;
38 if (!factors[i].
linearize(target, source, target_tree, T, i, rejector, &H, &b, &e)) {
54 return {Hs[0], bs[0], es[0]};
57 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud,
typename Factor>
58 double error(
const TargetPointCloud& target,
const SourcePointCloud& source,
const Eigen::Isometry3d& T, std::vector<Factor>& factors)
const {
61 #pragma omp parallel for num_threads(num_threads) schedule(guided, 8) reduction(+ : sum_e)
62 for (std::int64_t i = 0; i < factors.size(); i++) {
63 sum_e += factors[i].error(target, source, T);
Definition: flat_container.hpp:12
int omp_get_thread_num()
Definition: reduction_omp.hpp:11
Parallel reduction with OpenMP backend.
Definition: reduction_omp.hpp:17
double error(const TargetPointCloud &target, const SourcePointCloud &source, const Eigen::Isometry3d &T, std::vector< Factor > &factors) const
Definition: reduction_omp.hpp:58
int num_threads
Number of threads.
Definition: reduction_omp.hpp:68
ParallelReductionOMP()
Definition: reduction_omp.hpp:18
std::tuple< Eigen::Matrix< double, 6, 6 >, Eigen::Matrix< double, 6, 1 >, double > linearize(const TargetPointCloud &target, const SourcePointCloud &source, const TargetTree &target_tree, const CorrespondenceRejector &rejector, const Eigen::Isometry3d &T, std::vector< Factor > &factors) const
Definition: reduction_omp.hpp:21