Skip to content

Commit

Permalink
Use C++11 standard library for erfc.
Browse files Browse the repository at this point in the history
Still can't use it for pi, sadly.
  • Loading branch information
TallJimbo committed Apr 20, 2017
1 parent 614ed9d commit 3e3366c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Blendedness.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

#include <cmath>

#include "boost/math/special_functions/erf.hpp"
#include <boost/math/constants/constants.hpp>
#include "boost/math/constants/constants.hpp"

#include "lsst/meas/base/Blendedness.h"
#include "lsst/afw/detection/HeavyFootprint.h"
Expand Down Expand Up @@ -280,7 +279,7 @@ BlendednessAlgorithm::BlendednessAlgorithm(Control const & ctrl, std::string co
}

float BlendednessAlgorithm::computeAbsExpectation(float data, float variance) {
float normalization = 0.5f*boost::math::erfc(-data/std::sqrt(2.0f*variance));
float normalization = 0.5f*std::erfc(-data/std::sqrt(2.0f*variance));
if (!(normalization > 0)) {
// avoid division by zero; we know the limit at data << -sigma -> 0.
return 0.0;
Expand All @@ -292,7 +291,7 @@ float BlendednessAlgorithm::computeAbsExpectation(float data, float variance) {
float BlendednessAlgorithm::computeAbsBias(float mu, float variance) {
return (std::sqrt(2.0f*variance/boost::math::constants::pi<float>()) *
std::exp(-0.5f*(mu*mu)/variance)) -
mu*boost::math::erfc(mu/std::sqrt(2.0f*variance));
mu*std::erfc(mu/std::sqrt(2.0f*variance));
}

void BlendednessAlgorithm::_measureMoments(
Expand Down

0 comments on commit 3e3366c

Please sign in to comment.