39#define G_EVAL "GModel::eval(GObservation&, GMatrixSparse*)"
128 if (
this != &model) {
180 bool grad = ((gradients != NULL) && (npars > 0));
184 if (gradients->
columns() != npars) {
186 " columns in gradient matrix differs from number "
188 "in model. Please provide a compatible gradient "
192 if (gradients->
rows() != nevents) {
194 " rows in gradient matrix differs from number "
196 "observation. Please provide a compatible "
210 tmp_gradients =
new GVector[npars];
211 for (
int i = 0; i < npars; ++i) {
212 tmp_gradients[i] =
GVector(nevents);
218 for (
int i = 0; i < npars; ++i) {
228 for (
int k = 0; k < nevents; ++k) {
234 values[k] =
eval(event, obs, grad);
240 for (
int i = 0; i < npars; ++i) {
255 for (
int i = 0; i < npars; ++i) {
256 gradients->
column(i, tmp_gradients[i]);
260 delete [] tmp_gradients;
Exception handler interface definition.
Sparse matrix class definition.
Abstract data model base class interface definition.
Abstract observation base class interface definition.
Vector class interface definition.
Abstract interface for the event classes.
virtual int size(void) const =0
const int & rows(void) const
Return number of matrix rows.
const int & columns(void) const
Return number of matrix columns.
Sparse matrix class interface definition.
virtual GVector column(const int &column) const
Extract column as vector from matrix.
Abstract data model class.
virtual ~GModelData(void)
Destructor.
void init_members(void)
Initialise class members.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0
GModelData(void)
Void constructor.
void copy_members(const GModelData &model)
Copy class members.
void free_members(void)
Delete class members.
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
int size(void) const
Return number of parameters in model.
virtual GModel & operator=(const GModel &model)
Assignment operator.
Abstract observation base class.
virtual GEvents * events(void)
Return events.
void computed_gradient(const GModel &model, const GModelPar &par) const
Signals that an analytical gradient was computed for a model parameter.
bool is_free(void) const
Signal if parameter is free.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
const double & factor_gradient(void) const
Return parameter factor gradient.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.