diff --git a/apps/include/pcl/apps/vfh_nn_classifier.h b/apps/include/pcl/apps/vfh_nn_classifier.h index 06d6a907a47..d3eac8cf071 100644 --- a/apps/include/pcl/apps/vfh_nn_classifier.h +++ b/apps/include/pcl/apps/vfh_nn_classifier.h @@ -246,7 +246,7 @@ namespace pcl // compute the VFH feature for this point cloud FeatureCloudPtr vfhs = computeFeature (testing_data); // compute gaussian parameter producing the desired minimum score (around 50 for the default values) - float gaussian_param = - static_cast (radius / log (min_score)); + float gaussian_param = - static_cast (radius / std::log (min_score)); // TODO accept result to be filled in by reference return classifier_.classify(vfhs->points.at (0), radius, gaussian_param); } diff --git a/common/include/pcl/common/impl/norms.hpp b/common/include/pcl/common/impl/norms.hpp index 6d5852afbb5..286ace107ba 100644 --- a/common/include/pcl/common/impl/norms.hpp +++ b/common/include/pcl/common/impl/norms.hpp @@ -144,7 +144,7 @@ B_Norm (FloatVectorT a, FloatVectorT b, int dim) norm += std::sqrt (a[i] * b[i]); if (norm > 0) - result = -logf (norm); + result = -std::log (norm); else result = 0; @@ -185,7 +185,7 @@ Div_Norm (FloatVectorT a, FloatVectorT b, int dim) for (int i = 0; i < dim; ++i) if ((a[i] / b[i]) > 0) - norm += (a[i] - b[i]) * logf (a[i] / b[i]); + norm += (a[i] - b[i]) * std::log (a[i] / b[i]); else norm += 0; return norm; @@ -221,7 +221,7 @@ KL_Norm (FloatVectorT a, FloatVectorT b, int dim) for (int i = 0; i < dim; ++i) if ( (b[i] != 0) && ((a[i] / b[i]) > 0) ) - norm += a[i] * logf (a[i] / b[i]); + norm += a[i] * std::log (a[i] / b[i]); else norm += 0; return norm; diff --git a/cuda/sample_consensus/src/msac.cpp b/cuda/sample_consensus/src/msac.cpp index 31b95ddaf6f..73daa198a72 100644 --- a/cuda/sample_consensus/src/msac.cpp +++ b/cuda/sample_consensus/src/msac.cpp @@ -157,7 +157,7 @@ pcl_cuda::MultiRandomSampleConsensus::computeModel (int debug_verbosity n_best_inliers_count = n_inliers_count; good_coeff = cur_iteration; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)n_best_inliers_count / (float)nr_remaining_points); float p_no_outliers = 1.0f - w; p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf @@ -165,7 +165,7 @@ pcl_cuda::MultiRandomSampleConsensus::computeModel (int debug_verbosity if (p_no_outliers == 1.0f) k++; else - k = log (1.0f - probability_) / log (p_no_outliers); + k = std::log (1.0f - probability_) / std::log (p_no_outliers); } //fprintf (stderr, "[pcl_cuda::MultiRandomSampleConsensus::computeModel] Trial %d out of %f: %d inliers (best is: %d so far).\n", @@ -184,18 +184,18 @@ pcl_cuda::MultiRandomSampleConsensus::computeModel (int debug_verbosity //if (nr_remaining_points != nr_remaining_points_before_delete) { - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)min_nr_in_shape / (float)nr_remaining_points); float p_no_outliers = 1.0f - w; p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1.0f - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. if (p_no_outliers != 1.0f) { - if (log (1.0f - probability_) / log (p_no_outliers) < valid_iterations) // we won't find a model with min_nr_in_shape points anymore... + if (std::log (1.0f - probability_) / std::log (p_no_outliers) < valid_iterations) // we won't find a model with min_nr_in_shape points anymore... find_no_better = true; else if (debug_verbosity_level > 1) - std::cerr << "------->" << log (1.0f - probability_) / log (p_no_outliers) << " -vs- " << valid_iterations << std::endl; + std::cerr << "------->" << std::log (1.0f - probability_) / std::log (p_no_outliers) << " -vs- " << valid_iterations << std::endl; } } @@ -274,7 +274,7 @@ pcl_cuda::MultiRandomSampleConsensus::computeModel (int debug_verbosity n_best_inliers_count = n_inliers_count; good_coeff = b * iterations_per_batch_ + j; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)n_best_inliers_count / (float)nr_remaining_points); float p_no_outliers = 1.0f - w; p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf @@ -282,7 +282,7 @@ pcl_cuda::MultiRandomSampleConsensus::computeModel (int debug_verbosity if (p_no_outliers == 1.0f) k++; else - k = log (1.0f - probability_) / log (p_no_outliers); + k = std::log (1.0f - probability_) / std::log (p_no_outliers); } } diff --git a/cuda/sample_consensus/src/multi_ransac.cu b/cuda/sample_consensus/src/multi_ransac.cu index 682bd4464b5..6f480e1ff99 100644 --- a/cuda/sample_consensus/src/multi_ransac.cu +++ b/cuda/sample_consensus/src/multi_ransac.cu @@ -178,7 +178,7 @@ namespace pcl n_best_inliers_count = n_inliers_count; good_coeff = cur_iteration; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)n_best_inliers_count / (float)nr_remaining_points); float p_no_outliers = 1.0f - pow (w, 1.0f); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf @@ -186,7 +186,7 @@ namespace pcl if (p_no_outliers == 1.0f) k++; else - k = log (1.0f - probability_) / log (p_no_outliers); + k = std::log (1.0f - probability_) / std::log (p_no_outliers); } //fprintf (stderr, "[pcl::cuda::MultiRandomSampleConsensus::computeModel] Trial %d out of %f: %d inliers (best is: %d so far).\n", @@ -205,18 +205,18 @@ namespace pcl //if (nr_remaining_points != nr_remaining_points_before_delete) { - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)min_nr_in_shape / (float)nr_remaining_points); float p_no_outliers = 1.0f - pow (w, 1.0f); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1.0f - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. if (p_no_outliers != 1.0f) { - if (log (1.0f - probability_) / log (p_no_outliers) < valid_iterations) // we won't find a model with min_nr_in_shape points anymore... + if (std::log (1.0f - probability_) / std::log (p_no_outliers) < valid_iterations) // we won't find a model with min_nr_in_shape points anymore... find_no_better = true; else if (debug_verbosity_level > 1) - std::cerr << "------->" << log (1.0f - probability_) / log (p_no_outliers) << " -vs- " << valid_iterations << std::endl; + std::cerr << "------->" << std::log (1.0f - probability_) / std::log (p_no_outliers) << " -vs- " << valid_iterations << std::endl; } } @@ -297,7 +297,7 @@ namespace pcl n_best_inliers_count = n_inliers_count; good_coeff = b * iterations_per_batch_ + j; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)n_best_inliers_count / (float)nr_remaining_points); float p_no_outliers = 1.0f - pow (w, 1.0f); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf @@ -305,7 +305,7 @@ namespace pcl if (p_no_outliers == 1.0f) k++; else - k = log (1.0f - probability_) / log (p_no_outliers); + k = std::log (1.0f - probability_) / std::log (p_no_outliers); } } diff --git a/cuda/sample_consensus/src/ransac.cu b/cuda/sample_consensus/src/ransac.cu index 1c9f3cf509d..1374185aeff 100644 --- a/cuda/sample_consensus/src/ransac.cu +++ b/cuda/sample_consensus/src/ransac.cu @@ -127,7 +127,7 @@ namespace pcl good_coeff = iterations_; #endif - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) float w = (float)((float)n_best_inliers_count / (float)sac_model_->getIndices ()->size ()); // float p_no_outliers = 1.0 - pow (w, (float)selection.size ()); float p_no_outliers = 1.0f - pow (w, (float)1); @@ -136,7 +136,7 @@ namespace pcl if (p_no_outliers == 1.0f) k++; else - k = log (1.0f - probability_) / log (p_no_outliers); + k = std::log (1.0f - probability_) / std::log (p_no_outliers); } ++iterations_; diff --git a/examples/segmentation/example_supervoxels.cpp b/examples/segmentation/example_supervoxels.cpp index 2e3ccc290d4..0baa1afa7b1 100644 --- a/examples/segmentation/example_supervoxels.cpp +++ b/examples/segmentation/example_supervoxels.cpp @@ -269,7 +269,7 @@ main (int argc, char ** argv) ////////////////////////////// ////////////////////////////// // If the cloud is organized and we haven't disabled the transform we need to - // check that there are no negative z values, since we use log(z) + // check that there are no negative z values, since we use std::log(z) if (cloud->isOrganized () && !disable_transform) { for (const auto &point : *cloud) diff --git a/features/include/pcl/features/impl/3dsc.hpp b/features/include/pcl/features/impl/3dsc.hpp index 63c3b0bf843..1ae852438e0 100644 --- a/features/include/pcl/features/impl/3dsc.hpp +++ b/features/include/pcl/features/impl/3dsc.hpp @@ -77,7 +77,7 @@ pcl::ShapeContext3DEstimation::initCompute () // Fills radii interval based on formula (1) in section 2.1 of Frome's paper radii_interval_.resize (radius_bins_ + 1); for (size_t j = 0; j < radius_bins_ + 1; j++) - radii_interval_[j] = static_cast (std::exp (log (min_radius_) + ((static_cast (j) / static_cast (radius_bins_)) * log (search_radius_ / min_radius_)))); + radii_interval_[j] = static_cast (std::exp (std::log (min_radius_) + ((static_cast (j) / static_cast (radius_bins_)) * std::log (search_radius_ / min_radius_)))); // Fill theta divisions of elevation theta_divisions_.resize (elevation_bins_ + 1); diff --git a/features/include/pcl/features/impl/brisk_2d.hpp b/features/include/pcl/features/impl/brisk_2d.hpp index b1c198ce479..5eda6d19b0e 100644 --- a/features/include/pcl/features/impl/brisk_2d.hpp +++ b/features/include/pcl/features/impl/brisk_2d.hpp @@ -114,7 +114,7 @@ pcl::BRISK2DEstimation::generateKern BriskPatternPoint* pattern_iterator = pattern_points_; // define the scale discretization: - static const float lb_scale = logf (scalerange_) / logf (2.0); + static const float lb_scale = std::log (scalerange_) / std::log (2.0); static const float lb_scale_step = lb_scale / (float (scales_)); scale_list_ = new float[scales_]; diff --git a/features/include/pcl/features/impl/usc.hpp b/features/include/pcl/features/impl/usc.hpp index c12724529d0..c31c1089ca1 100644 --- a/features/include/pcl/features/impl/usc.hpp +++ b/features/include/pcl/features/impl/usc.hpp @@ -93,7 +93,7 @@ pcl::UniqueShapeContext::initCompute () // Fills radii interval based on formula (1) in section 2.1 of Frome's paper radii_interval_.resize (radius_bins_ + 1); for (size_t j = 0; j < radius_bins_ + 1; j++) - radii_interval_[j] = static_cast (std::exp (log (min_radius_) + ((static_cast (j) / static_cast (radius_bins_)) * log (search_radius_/min_radius_)))); + radii_interval_[j] = static_cast (std::exp (std::log (min_radius_) + ((static_cast (j) / static_cast (radius_bins_)) * std::log (search_radius_/min_radius_)))); // Fill theta didvisions of elevation theta_divisions_.resize (elevation_bins_+1); diff --git a/gpu/people/include/pcl/gpu/people/tree_train.h b/gpu/people/include/pcl/gpu/people/tree_train.h index 7720d71fa46..88d1cabf193 100644 --- a/gpu/people/include/pcl/gpu/people/tree_train.h +++ b/gpu/people/include/pcl/gpu/people/tree_train.h @@ -96,7 +96,7 @@ namespace pcl for(int li=0;li A) pixel = A; double dy = y*0.1; - double dist = (log (static_cast (pixel / A)) / B - dy) * (7E-07*r3 - 0.0001*r2 + 0.004*r1 + 0.9985) * 1.5; + double dist = (std::log (static_cast (pixel / A)) / B - dy) * (7E-07*r3 - 0.0001*r2 + 0.004*r1 + 0.9985) * 1.5; double theta_colati = fov_ * r1 * dist_max_2d_; double c_theta = std::cos (theta_colati); double s_theta = sin (theta_colati); diff --git a/ml/src/svm.cpp b/ml/src/svm.cpp index 4f16676534d..5b27eac8e07 100755 --- a/ml/src/svm.cpp +++ b/ml/src/svm.cpp @@ -1989,7 +1989,7 @@ static void sigmoid_train ( // Initial Point and Initial Fun Value A = 0.0; - B = log ( (prior0 + 1.0) / (prior1 + 1.0)); + B = std::log ( (prior0 + 1.0) / (prior1 + 1.0)); double fval = 0.0; @@ -2003,9 +2003,9 @@ static void sigmoid_train ( double fApB = dec_values[i] * A + B; if (fApB >= 0) - fval += t[i] * fApB + log (1 + std::exp (-fApB)); + fval += t[i] * fApB + std::log (1 + std::exp (-fApB)); else - fval += (t[i] - 1) * fApB + log (1 + std::exp (fApB)); + fval += (t[i] - 1) * fApB + std::log (1 + std::exp (fApB)); } int iter = 0; @@ -2073,9 +2073,9 @@ static void sigmoid_train ( double fApB = dec_values[i] * newA + newB; if (fApB >= 0) - newf += t[i] * fApB + log (1 + std::exp (-fApB)); + newf += t[i] * fApB + std::log (1 + std::exp (-fApB)); else - newf += (t[i] - 1) * fApB + log (1 + std::exp (fApB)); + newf += (t[i] - 1) * fApB + std::log (1 + std::exp (fApB)); } // Check sufficient decrease diff --git a/recognition/include/pcl/recognition/face_detection/rf_face_utils.h b/recognition/include/pcl/recognition/face_detection/rf_face_utils.h index ef3ac85e76a..533c0b96a7a 100644 --- a/recognition/include/pcl/recognition/face_detection/rf_face_utils.h +++ b/recognition/include/pcl/recognition/face_detection/rf_face_utils.h @@ -413,9 +413,9 @@ namespace pcl std::vector hr (num_of_branches + 1, 0.f); for (size_t branch_index = 0; branch_index < (num_of_branches + 1); ++branch_index) { - hr[branch_index] = static_cast(0.5f * log (std::pow (2 * M_PI, 3) + hr[branch_index] = static_cast(0.5f * std::log (std::pow (2 * M_PI, 3) * offset_covariances[branch_index].determinant ()) - + 0.5f * log (std::pow (2 * M_PI, 3) + + 0.5f * std::log (std::pow (2 * M_PI, 3) * angle_covariances[branch_index].determinant ())); } diff --git a/recognition/include/pcl/recognition/impl/ransac_based/simple_octree.hpp b/recognition/include/pcl/recognition/impl/ransac_based/simple_octree.hpp index 7e9309ea307..b2b279a08cb 100644 --- a/recognition/include/pcl/recognition/impl/ransac_based/simple_octree.hpp +++ b/recognition/include/pcl/recognition/impl/ransac_based/simple_octree.hpp @@ -239,7 +239,7 @@ pcl::recognition::SimpleOctree::build (const // Compute the number of tree levels if ( arg > 1 ) - tree_levels_ = static_cast (ceil (log (arg)/log (2.0)) + 0.5); + tree_levels_ = static_cast (ceil (std::log (arg)/std::log (2.0)) + 0.5); else tree_levels_ = 0; diff --git a/recognition/include/pcl/recognition/ransac_based/obj_rec_ransac.h b/recognition/include/pcl/recognition/ransac_based/obj_rec_ransac.h index 4f9c6e724ca..2a28c8d3f1f 100644 --- a/recognition/include/pcl/recognition/ransac_based/obj_rec_ransac.h +++ b/recognition/include/pcl/recognition/ransac_based/obj_rec_ransac.h @@ -338,7 +338,7 @@ namespace pcl if ( 1.0 - p <= 0.0 ) return 1; - return static_cast (log (1.0-success_probability)/log (1.0-p) + 1.0); + return static_cast (std::log (1.0-success_probability)/std::log (1.0-p) + 1.0); } inline void diff --git a/recognition/src/ransac_based/orr_octree.cpp b/recognition/src/ransac_based/orr_octree.cpp index c09a01d70b9..7b19aff86dd 100644 --- a/recognition/src/ransac_based/orr_octree.cpp +++ b/recognition/src/ransac_based/orr_octree.cpp @@ -87,7 +87,7 @@ pcl::recognition::ORROctree::build (const float* bounds, float voxel_size) // Compute the number of tree levels if ( arg > 1.0f ) - tree_levels_ = static_cast (ceil (log (arg)/log (2.0)) + 0.5); + tree_levels_ = static_cast (ceil (std::log (arg)/std::log (2.0)) + 0.5); else tree_levels_ = 0; diff --git a/registration/include/pcl/registration/impl/ndt.hpp b/registration/include/pcl/registration/impl/ndt.hpp index 0e9e3d9c721..8dd5eeeca0e 100644 --- a/registration/include/pcl/registration/impl/ndt.hpp +++ b/registration/include/pcl/registration/impl/ndt.hpp @@ -59,9 +59,9 @@ pcl::NormalDistributionsTransform::NormalDistributions // Initializes the gaussian fitting parameters (eq. 6.8) [Magnusson 2009] gauss_c1 = 10.0 * (1 - outlier_ratio_); gauss_c2 = outlier_ratio_ / pow (resolution_, 3); - gauss_d3 = -log (gauss_c2); - gauss_d1_ = -log ( gauss_c1 + gauss_c2 ) - gauss_d3; - gauss_d2_ = -2 * log ((-log ( gauss_c1 * std::exp ( -0.5 ) + gauss_c2 ) - gauss_d3) / gauss_d1_); + gauss_d3 = -std::log (gauss_c2); + gauss_d1_ = -std::log ( gauss_c1 + gauss_c2 ) - gauss_d3; + gauss_d2_ = -2 * std::log ((-std::log ( gauss_c1 * std::exp ( -0.5 ) + gauss_c2 ) - gauss_d3) / gauss_d1_); transformation_epsilon_ = 0.1; max_iterations_ = 35; @@ -79,9 +79,9 @@ pcl::NormalDistributionsTransform::computeTransformati // Initializes the gaussian fitting parameters (eq. 6.8) [Magnusson 2009] gauss_c1 = 10 * (1 - outlier_ratio_); gauss_c2 = outlier_ratio_ / pow (resolution_, 3); - gauss_d3 = -log (gauss_c2); - gauss_d1_ = -log ( gauss_c1 + gauss_c2 ) - gauss_d3; - gauss_d2_ = -2 * log ((-log ( gauss_c1 * std::exp ( -0.5 ) + gauss_c2 ) - gauss_d3) / gauss_d1_); + gauss_d3 = -std::log (gauss_c2); + gauss_d1_ = -std::log ( gauss_c1 + gauss_c2 ) - gauss_d3; + gauss_d2_ = -2 * std::log ((-std::log ( gauss_c1 * std::exp ( -0.5 ) + gauss_c2 ) - gauss_d3) / gauss_d1_); if (guess != Eigen::Matrix4f::Identity ()) { diff --git a/sample_consensus/include/pcl/sample_consensus/impl/mlesac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/mlesac.hpp index 390af25d1ba..7bb48e36a76 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/mlesac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/mlesac.hpp @@ -130,10 +130,10 @@ pcl::MaximumLikelihoodSampleConsensus::computeModel (int debug_verbosity gamma /= static_cast(sac_model_->getIndices ()->size ()); } - // Find the log likelihood of the model -L = -sum [log (pInlierProb + pOutlierProb)] + // Find the std::log likelihood of the model -L = -sum [std::log (pInlierProb + pOutlierProb)] double d_cur_penalty = 0; for (size_t i = 0; i < indices_size; ++i) - d_cur_penalty += log (p_inlier_prob[i] + p_outlier_prob); + d_cur_penalty += std::log (p_inlier_prob[i] + p_outlier_prob); d_cur_penalty = - d_cur_penalty; // Better match ? @@ -151,12 +151,12 @@ pcl::MaximumLikelihoodSampleConsensus::computeModel (int debug_verbosity if (distance <= 2 * sigma_) n_inliers_count++; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) double w = static_cast (n_inliers_count) / static_cast (sac_model_->getIndices ()->size ()); double p_no_outliers = 1 - pow (w, static_cast (selection.size ())); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1 - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. - k = log (1 - probability_) / log (p_no_outliers); + k = std::log (1 - probability_) / std::log (p_no_outliers); } ++iterations_; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/msac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/msac.hpp index 7f97dded14e..e0fba67e5dc 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/msac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/msac.hpp @@ -109,12 +109,12 @@ pcl::MEstimatorSampleConsensus::computeModel (int debug_verbosity_level) if (distance <= threshold_) ++n_inliers_count; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) double w = static_cast (n_inliers_count) / static_cast (sac_model_->getIndices ()->size ()); double p_no_outliers = 1.0 - pow (w, static_cast (selection.size ())); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1.0 - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. - k = log (1.0 - probability_) / log (p_no_outliers); + k = std::log (1.0 - probability_) / std::log (p_no_outliers); } ++iterations_; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/prosac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/prosac.hpp index 674eaa3ff56..c3bf2299253 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/prosac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/prosac.hpp @@ -205,7 +205,7 @@ pcl::ProgressiveSampleConsensus::computeModel (int debug_verbosity_level else if (bottom_log == 1) k_n_star = T_N; else - k_n_star = static_cast (ceil (log (0.05) / log (bottom_log))); + k_n_star = static_cast (ceil (std::log (0.05) / std::log (bottom_log))); // It seems weird to have very few iterations, so do have a few (totally empirical) k_n_star = (std::max)(k_n_star, 2 * m); } diff --git a/sample_consensus/include/pcl/sample_consensus/impl/ransac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/ransac.hpp index bab6a1b9b31..4793aad0028 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/ransac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/ransac.hpp @@ -61,7 +61,7 @@ pcl::RandomSampleConsensus::computeModel (int) std::vector selection; Eigen::VectorXf model_coefficients; - double log_probability = log (1.0 - probability_); + double log_probability = std::log (1.0 - probability_); double one_over_indices = 1.0 / static_cast (sac_model_->getIndices ()->size ()); int n_inliers_count = 0; @@ -105,12 +105,12 @@ pcl::RandomSampleConsensus::computeModel (int) model_ = selection; model_coefficients_ = model_coefficients; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) double w = static_cast (n_best_inliers_count) * one_over_indices; double p_no_outliers = 1.0 - pow (w, static_cast (selection.size ())); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1.0 - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. - k = log_probability / log (p_no_outliers); + k = log_probability / std::log (p_no_outliers); } ++iterations_; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/rmsac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/rmsac.hpp index 4c4113f0d07..2e51bd9136c 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/rmsac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/rmsac.hpp @@ -127,12 +127,12 @@ pcl::RandomizedMEstimatorSampleConsensus::computeModel (int debug_verbos if (distance <= threshold_) n_inliers_count++; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) double w = static_cast (n_inliers_count) / static_cast(sac_model_->getIndices ()->size ()); double p_no_outliers = 1 - pow (w, static_cast (selection.size ())); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1 - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. - k = log (1 - probability_) / log (p_no_outliers); + k = std::log (1 - probability_) / std::log (p_no_outliers); } ++iterations_; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/rransac.hpp b/sample_consensus/include/pcl/sample_consensus/impl/rransac.hpp index 62aed6f42c6..c09488adc7b 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/rransac.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/rransac.hpp @@ -111,12 +111,12 @@ pcl::RandomizedRandomSampleConsensus::computeModel (int debug_verbosity_ model_ = selection; model_coefficients_ = model_coefficients; - // Compute the k parameter (k=log(z)/log(1-w^n)) + // Compute the k parameter (k=std::log(z)/std::log(1-w^n)) double w = static_cast (n_inliers_count) / static_cast (sac_model_->getIndices ()->size ()); double p_no_outliers = 1 - pow (w, static_cast (selection.size ())); p_no_outliers = (std::max) (std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by -Inf p_no_outliers = (std::min) (1 - std::numeric_limits::epsilon (), p_no_outliers); // Avoid division by 0. - k = log (1 - probability_) / log (p_no_outliers); + k = std::log (1 - probability_) / std::log (p_no_outliers); } ++iterations_; diff --git a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp index 0b065355b3d..c8c4e8a6b96 100644 --- a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp @@ -325,9 +325,9 @@ pcl::CrfSegmentation::createUnaryPotentials (std::vector &unary, // Certainty that the groundtruth is correct const float GT_PROB = 0.9f; - const float u_energy = -logf ( 1.0f / static_cast (n_labels) ); - const float n_energy = -logf ( (1.0f - GT_PROB) / static_cast(n_labels - 1) ); - const float p_energy = -logf ( GT_PROB ); + const float u_energy = -std::log ( 1.0f / static_cast (n_labels) ); + const float n_energy = -std::log ( (1.0f - GT_PROB) / static_cast(n_labels - 1) ); + const float p_energy = -std::log ( GT_PROB ); for (size_t k = 0; k < filtered_anno_->points.size (); k++) { @@ -362,8 +362,8 @@ pcl::CrfSegmentation::createUnaryPotentials (std::vector &unary, if (label == 1) { const float PROB = 0.2f; - const float n_energy2 = -logf ( (1.0f - PROB) / static_cast(n_labels - 1) ); - const float p_energy2 = -logf ( PROB ); + const float n_energy2 = -std::log ( (1.0f - PROB) / static_cast(n_labels - 1) ); + const float p_energy2 = -std::log ( PROB ); for (size_t i = 0; i < n_labels; i++) unary[u_idx + i] = n_energy2; diff --git a/simulation/src/range_likelihood.cpp b/simulation/src/range_likelihood.cpp index 48ba611ae24..6e82e923c04 100644 --- a/simulation/src/range_likelihood.cpp +++ b/simulation/src/range_likelihood.cpp @@ -90,7 +90,7 @@ float normal_sigma0x5_normal1x0_range0to3_step0x01[] = {1.59576912f, 1.59545000f // Where the above if lhoodf, this a hard coded/optimized version: //ratio = 0.99; r_min =0; r_max = 3; -//lhood = ratio/(r_max -r_min) + (1-ratio)*lhood ; hard_coded_log_lhood=log(lhood) +//lhood = ratio/(r_max -r_min) + (1-ratio)*lhood ; hard_coded_log_lhood=std::log(lhood) float hard_coded_log_lhood[] = {-1.0614388f, -1.0614480f, -1.0614757f, -1.0615217f, -1.0615862f, -1.0616689f, -1.0617698f, -1.0618887f, -1.0620256f, -1.0621803f, -1.0623526f, -1.0625423f, -1.0627491f, -1.0629730f, -1.0632135f, -1.0634705f, -1.0637437f, -1.0640327f, -1.0643372f, -1.0646569f, -1.0649914f, -1.0653405f, -1.0657036f, -1.0660804f, -1.0664705f, -1.0668735f, -1.0672889f, -1.0677164f, -1.0681554f, -1.0686054f, -1.0690662f, -1.0695370f, -1.0700176f, -1.0705073f, -1.0710057f, -1.0715124f, -1.0720267f, -1.0725482f, -1.0730764f, -1.0736108f, -1.0741509f, -1.0746962f, -1.0752462f, -1.0758003f, -1.0763581f, -1.0769191f, -1.0774827f, -1.0780486f, -1.0786162f, -1.0791851f, -1.0797547f, -1.0803247f, -1.0808945f, -1.0814638f, -1.0820321f, -1.0825989f, -1.0831639f, -1.0837267f, -1.0842868f, -1.0848439f, -1.0853977f, -1.0859476f, -1.0864935f, -1.0870350f, -1.0875718f, -1.0881035f, -1.0886298f, -1.0891506f, -1.0896655f, -1.0901742f, -1.0906766f, -1.0911723f, -1.0916613f, -1.0921433f, -1.0926181f, -1.0930855f, -1.0935454f, -1.0939976f, -1.0944421f, -1.0948787f, -1.0953073f, -1.0957277f, -1.0961400f, -1.0965441f, -1.0969398f, -1.0973272f, -1.0977063f, -1.0980769f, -1.0984391f, -1.0987930f, -1.0991384f, -1.0994755f, -1.0998042f, -1.1001246f, -1.1004367f, -1.1007407f, -1.1010364f, -1.1013241f, -1.1016038f, -1.1018756f, -1.1021396f, -1.1023958f, -1.1026444f, -1.1028855f, -1.1031191f, -1.1033454f, -1.1035646f, -1.1037767f, -1.1039819f, -1.1041802f, -1.1043719f, -1.1045570f, -1.1047358f, -1.1049082f, -1.1050746f, -1.1052349f, -1.1053894f, -1.1055382f, -1.1056815f, -1.1058193f, -1.1059518f, -1.1060792f, -1.1062016f, -1.1063192f, -1.1064320f, -1.1065402f, -1.1066440f, -1.1067435f, -1.1068389f, -1.1069302f, -1.1070176f, -1.1071012f, -1.1071811f, -1.1072575f, -1.1073306f, -1.1074003f, -1.1074668f, -1.1075303f, -1.1075909f, -1.1076486f, -1.1077036f, -1.1077560f, -1.1078059f, -1.1078533f, -1.1078985f, -1.1079414f, -1.1079821f, -1.1080208f, -1.1080576f, -1.1080925f, -1.1081256f, -1.1081569f, -1.1081867f, -1.1082148f, -1.1082415f, -1.1082667f, -1.1082906f, -1.1083132f, -1.1083345f, -1.1083547f, -1.1083737f, -1.1083917f, -1.1084086f, -1.1084246f, -1.1084397f, -1.1084538f, -1.1084672f, -1.1084798f, -1.1084917f, -1.1085028f, -1.1085133f, -1.1085231f, -1.1085324f, -1.1085411f, -1.1085492f, -1.1085569f, -1.1085640f, -1.1085707f, -1.1085770f, -1.1085829f, -1.1085885f, -1.1085936f, -1.1085985f, -1.1086030f, -1.1086072f, -1.1086111f, -1.1086148f, -1.1086183f, -1.1086215f, -1.1086245f, -1.1086272f, -1.1086298f, -1.1086323f, -1.1086345f, -1.1086366f, -1.1086385f, -1.1086404f, -1.1086420f, -1.1086436f, -1.1086451f, -1.1086464f, -1.1086477f, -1.1086488f, -1.1086499f, -1.1086509f, -1.1086518f, -1.1086527f, -1.1086534f, -1.1086542f, -1.1086549f, -1.1086555f, -1.1086561f, -1.1086566f, -1.1086571f, -1.1086575f, -1.1086580f, -1.1086583f, -1.1086587f, -1.1086590f, -1.1086593f, -1.1086596f, -1.1086599f, -1.1086601f, -1.1086603f, -1.1086605f, -1.1086607f, -1.1086609f, -1.1086610f, -1.1086611f, -1.1086613f, -1.1086614f, -1.1086615f, -1.1086616f, -1.1086617f, -1.1086618f, -1.1086619f, -1.1086619f, -1.1086620f, -1.1086620f, -1.1086621f, -1.1086621f, -1.1086622f, -1.1086622f, -1.1086623f, -1.1086623f, -1.1086623f, -1.1086624f, -1.1086624f, -1.1086624f, -1.1086624f, -1.1086624f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086625f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f, -1.1086626f}; // Disparity: @@ -449,7 +449,7 @@ costFunction1 (float ref_val, float depth_val) { // required to lessen the effect of modelpixel with no range (ie holes in the model) cost = 10; } - //return log (cost); + //return std::log (cost); return (cost); } @@ -468,11 +468,11 @@ costFunction2 (float ref_val, float depth_val) double lhood = 1; if (std::isnan (depth_val)) { // pixels with nan depth - for openNI null points - lhood = 1; // log(1) = 0 ---> has no effect + lhood = 1; // std::log(1) = 0 ---> has no effect } else if(ref_val < 0) { // all RGB pixels with no depth - for freenect null points - lhood = 1; // log(1) = 0 ---> has no effect + lhood = 1; // std::log(1) = 0 ---> has no effect } else { @@ -487,14 +487,14 @@ costFunction2 (float ref_val, float depth_val) double r_max = 3; // metres lhood = ratio/(r_max -r_min) + (1-ratio)*lhood ; } - return static_cast (log (lhood)); + return static_cast (std::log (lhood)); } float costFunction3 (float ref_val,float depth_val) { float log_lhood=0; - // log(1) = 0 ---> has no effect + // std::log(1) = 0 ---> has no effect if (ref_val < 0) { // all images pixels with no range @@ -550,9 +550,9 @@ costFunction4(float ref_val,float depth_val) if (ref_val< 0) { // all images pixels with no range - lhood = 1; // log(1) = 0 ---> has no effect + lhood = 1; // std::log(1) = 0 ---> has no effect } - return log(lhood); + return std::log(lhood); } // TODO: WHEN WE'RE HAPPY THIS SHOULD BE "THE" LIKELIHOOD FUNCTION @@ -579,10 +579,10 @@ double costFunction5(double measured_depth, double model_disp, double sigma, dou double lhood= (floor_proportion/(upper_bound-lower_bound) + (1-floor_proportion)*trunc_gaussian_part); if (measured_depth< 0){ // all images pixels with no range - lhood = 1; // log(1) = 0 ---> has no effect + lhood = 1; // std::log(1) = 0 ---> has no effect } - return log (lhood); + return std::log (lhood); } void diff --git a/tracking/include/pcl/tracking/impl/coherence.hpp b/tracking/include/pcl/tracking/impl/coherence.hpp index 77380a53eff..66c9cedb059 100644 --- a/tracking/include/pcl/tracking/impl/coherence.hpp +++ b/tracking/include/pcl/tracking/impl/coherence.hpp @@ -22,7 +22,7 @@ namespace pcl for (size_t i = 0; i < point_coherences_.size (); i++) { PointCoherencePtr coherence = point_coherences_[i]; - double d = log(coherence->compute (source, target)); + double d = std::log(coherence->compute (source, target)); //double d = coherence->compute (source, target); if (! std::isnan(d)) val += d;