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;
void computed_gradient(const GModel &model, const GModelPar &par) const
Signals that an analytical gradient was computed for a model parameter.
const double & factor_gradient(void) const
Return parameter factor gradient.
Sparse matrix class interface definition.
Abstract interface for the event classes.
void free_members(void)
Delete class members.
bool is_free(void) const
Signal if parameter is free.
int size(void) const
Return number of parameters in model.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
const int & rows(void) const
Return number of matrix rows.
Abstract data model base class interface definition.
GModelData(void)
Void constructor.
Abstract data model class.
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
Abstract observation base class.
Vector class interface definition.
Abstract observation base class interface definition.
virtual ~GModelData(void)
Destructor.
void copy_members(const GModelData &model)
Copy class members.
virtual GVector column(const int &column) const
Extract column as vector from matrix.
Sparse matrix class definition.
virtual GEvents * events(void)
Return events.
Exception handler interface definition.
virtual GModel & operator=(const GModel &model)
Assignment operator.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0
const int & columns(void) const
Return number of matrix columns.
void init_members(void)
Initialise class members.
virtual int size(void) const =0
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.