61 lines
1.3 KiB
C++
Executable File
61 lines
1.3 KiB
C++
Executable File
#ifndef COSTFUNCTIONS_H
|
|
#define COSTFUNCTIONS_H
|
|
|
|
#include<vector>
|
|
|
|
/*
|
|
* Cost Functions
|
|
*/
|
|
|
|
class CostFunction{
|
|
public:
|
|
//Virtual Constructor & Destructor for any cost function
|
|
CostFunction(){};
|
|
CostFunction(const CostFunction&){};
|
|
virtual ~CostFunction(){};
|
|
//Virtual getter for the values of any cost function
|
|
virtual double get() const = 0;
|
|
};
|
|
|
|
/*
|
|
* Least squared cost
|
|
*/
|
|
|
|
class Khi2 : public CostFunction{
|
|
public:
|
|
//Constructor & Destructor for a Khi2 type cost
|
|
Khi2();
|
|
Khi2(const Khi2&);
|
|
Khi2(std::vector<std::vector<double>>,std::vector<std::vector<double>>);
|
|
~Khi2(){};
|
|
//Set new data sets
|
|
void setData(std::vector<std::vector<double>>,std::vector<std::vector<double>>);
|
|
//Get the value of this cost
|
|
double get() const;
|
|
private:
|
|
std::vector<std::vector<double>> k_exp;
|
|
std::vector<std::vector<double>> k_mod;
|
|
};
|
|
|
|
/*
|
|
* Total distance
|
|
*/
|
|
|
|
class Distance : public CostFunction{
|
|
public:
|
|
//Constructor & Destructor for a Distance type cost
|
|
Distance();
|
|
Distance(const Distance&);
|
|
Distance(std::vector<std::vector<double>>,std::vector<int>);
|
|
~Distance(){};
|
|
//Set new data sets
|
|
void setData(std::vector<std::vector<double>>,std::vector<int>);
|
|
//Get the value of this cost
|
|
double get() const;
|
|
private:
|
|
std::vector<std::vector<double>> d_pos;
|
|
std::vector<int> d_ord;
|
|
};
|
|
|
|
#endif
|