27 m_includePenalty =
false;
36 std::vector<double> weights(values->size());
37 for (
size_t i = 0; i < weights.size(); ++i) {
48 return (values->getFitWeight(i) / sqrtW);
58 size_t ny = values->size();
59 for (
size_t i = 0; i < ny; ++i) {
60 double obsval = values->getFitData(i);
61 double inv_sigma = values->getFitWeight(i);
62 weight += obsval * obsval * inv_sigma * inv_sigma;
const std::string & m_value
#define DECLARE_COSTFUNCTION(classname, username)
Macro for declaring a new type of cost functions to be used with the CostFunctionFactory.
Cost function for least squares.
Cost function for Rwp = (sum_i (( obs_i - cal_i )/sigma_i)**2 ) / (sum_i (obs_i/sigma_i)**2)
std::vector< double > getFitWeights(API::FunctionValues_sptr values) const override
Get mapped weights from FunctionValues.
double calSqrtW(const API::FunctionValues_sptr &values) const
Calcualte sqrt(W).
double getWeight(const API::FunctionValues_sptr &values, size_t i, double sqrtW=1.0) const
Get weight (1/sigma)
std::shared_ptr< FunctionValues > FunctionValues_sptr
typedef for a shared pointer