Top | ![]() |
![]() |
![]() |
![]() |
Functions
Properties
NcmObjArray * | equality-constraints | Read / Write |
NcmVector * | equality-constraints-tot | Read / Write |
NcmFitGradType | grad-type | Read / Write / Construct |
NcmObjArray * | inequality-constraints | Read / Write |
NcmVector * | inequality-constraints-tot | Read / Write |
NcmLikelihood * | likelihood | Read / Write / Construct Only |
double | m2lnL-abstol | Read / Write / Construct |
double | m2lnL-reltol | Read / Write / Construct |
guint | maxiter | Read / Write / Construct |
NcmMSet * | mset | Read / Write / Construct Only |
double | params-reltol | Read / Write / Construct |
NcmFitState * | state | Read / Write / Construct Only |
NcmFit * | sub-fit | Read / Write |
Types and Values
enum | NcmFitType |
enum | NcmFitGradType |
enum | NcmFitRunMsgs |
#define | NCM_FIT_DEFAULT_M2LNL_RELTOL |
#define | NCM_FIT_DEFAULT_M2LNL_ABSTOL |
#define | NCM_FIT_DEFAULT_PARAMS_RELTOL |
#define | NCM_FIT_DEFAULT_MAXITER |
Object Hierarchy
GEnum ├── NcmFitGradType ├── NcmFitRunMsgs ╰── NcmFitType GObject ╰── NcmFit ├── NcmFitGSLLS ├── NcmFitGSLMM ├── NcmFitGSLMMS ├── NcmFitLevmar ╰── NcmFitNLOpt
Functions
ncm_fit_new ()
NcmFit * ncm_fit_new (NcmFitType ftype
,gchar *algo_name
,NcmLikelihood *lh
,NcmMSet *mset
,NcmFitGradType gtype
);
FIXME
ncm_fit_copy_new ()
NcmFit * ncm_fit_copy_new (NcmFit *fit
,NcmLikelihood *lh
,NcmMSet *mset
,NcmFitGradType gtype
);
Duplicates the NcmFit object with new references for its contents.
ncm_fit_dup ()
NcmFit * ncm_fit_dup (NcmFit *fit
,NcmSerialize *ser
);
Duplicates the NcmFit object duplicating all its contents.
ncm_fit_free ()
void
ncm_fit_free (NcmFit *fit
);
Atomically decrements the reference count of fit
by one. If the reference count drops to 0,
all memory allocated by fit
is released.
ncm_fit_clear ()
void
ncm_fit_clear (NcmFit **fit
);
The reference count of fit
is decreased and the pointer is set to NULL.
ncm_fit_set_maxiter ()
void ncm_fit_set_maxiter (NcmFit *fit
,guint maxiter
);
Sets the maximum number of iterations.
ncm_fit_get_maxiter ()
guint
ncm_fit_get_maxiter (NcmFit *fit
);
Gets the maximum number of iterations.
ncm_fit_params_set_vector_offset ()
void ncm_fit_params_set_vector_offset (NcmFit *fit
,NcmVector *x
,guint offset
);
FIXME
ncm_fit_params_set_gsl_vector ()
void ncm_fit_params_set_gsl_vector (NcmFit *fit
,const gsl_vector *x
);
FIXME
[skip]
ncm_fit_add_equality_constraint ()
void ncm_fit_add_equality_constraint (NcmFit *fit
,NcmMSetFunc *func
,const gdouble tot
);
FIXME
ncm_fit_add_inequality_constraint ()
void ncm_fit_add_inequality_constraint (NcmFit *fit
,NcmMSetFunc *func
,const gdouble tot
);
FIXME
ncm_fit_remove_equality_constraints ()
void
ncm_fit_remove_equality_constraints (NcmFit *fit
);
FIXME
ncm_fit_remove_inequality_constraints ()
void
ncm_fit_remove_inequality_constraints (NcmFit *fit
);
FIXME
ncm_fit_is_least_squares ()
gboolean
ncm_fit_is_least_squares (NcmFit *fit
);
Indicates if the least squares fitting is being used (TRUE) or not (FALSE).
ncm_fit_log_covar ()
void
ncm_fit_log_covar (NcmFit *fit
);
Prints to the log file the names and indices of the fitted parameters, their best-fit values, standard deviations and correlation matrix.
ncm_fit_log_state ()
void
ncm_fit_log_state (NcmFit *fit
);
This function prints in the log the current state.
ncm_fit_log_step_error ()
void ncm_fit_log_step_error (NcmFit *fit
,const gchar *strerror
,...
);
FIXME
ncm_fit_log_end ()
void
ncm_fit_log_end (NcmFit *fit
);
This function prints in the log the precision with which the best-fit was found.
ncm_fit_fishermatrix_print ()
void ncm_fit_fishermatrix_print (NcmFit *fit
,FILE *out
,gchar *header
);
ncm_fit_data_m2lnL_val ()
void ncm_fit_data_m2lnL_val (NcmFit *fit
,gdouble *data_m2lnL
);
This function computes minus two times the logarithm base e of the likelihood
using only the data set and not considering any prior. The result is set
on data_m2lnL
.
ncm_fit_priors_m2lnL_val ()
void ncm_fit_priors_m2lnL_val (NcmFit *fit
,gdouble *priors_m2lnL
);
This function computes minus two times the logarithm base e of the likelihood
using the data set and taking into account the assumed priors. The result is
set on priors_m2lnL
.
ncm_fit_m2lnL_grad_an ()
void ncm_fit_m2lnL_grad_an (NcmFit *fit
,NcmVector *df
);
Analytical gradient.
ncm_fit_m2lnL_grad_nd_fo ()
void ncm_fit_m2lnL_grad_nd_fo (NcmFit *fit
,NcmVector *grad
);
Numerical differentiation (forward).
ncm_fit_m2lnL_grad_nd_ce ()
void ncm_fit_m2lnL_grad_nd_ce (NcmFit *fit
,NcmVector *grad
);
Numerical differentiation (central).
ncm_fit_m2lnL_grad_nd_ac ()
void ncm_fit_m2lnL_grad_nd_ac (NcmFit *fit
,NcmVector *grad
);
Numerical differentiation (accurate).
ncm_fit_m2lnL_hessian_nd_ce ()
void ncm_fit_m2lnL_hessian_nd_ce (NcmFit *fit
,NcmMatrix *hessian
);
Numerical differentiation (central) Hessian matrix.
ncm_fit_m2lnL_val_grad ()
void ncm_fit_m2lnL_val_grad (NcmFit *fit
,gdouble *result
,NcmVector *df
);
FIXME
ncm_fit_m2lnL_val_grad_an ()
void ncm_fit_m2lnL_val_grad_an (NcmFit *fit
,gdouble *result
,NcmVector *df
);
FIXME
ncm_fit_m2lnL_val_grad_nd_fo ()
void ncm_fit_m2lnL_val_grad_nd_fo (NcmFit *fit
,gdouble *m2lnL
,NcmVector *grad
);
FIXME
ncm_fit_m2lnL_val_grad_nd_ce ()
void ncm_fit_m2lnL_val_grad_nd_ce (NcmFit *fit
,gdouble *m2lnL
,NcmVector *grad
);
FIXME
ncm_fit_m2lnL_val_grad_nd_ac ()
void ncm_fit_m2lnL_val_grad_nd_ac (NcmFit *fit
,gdouble *m2lnL
,NcmVector *grad
);
FIXME
ncm_fit_fisher_to_covar ()
void ncm_fit_fisher_to_covar (NcmFit *fit
,NcmMatrix *fisher
);
Inverts the matrix fisher
and sets as the covariance matrix
of fit
. The Fisher matrix used can be both the Fisher or the
observed Fisher matrices.
ncm_fit_obs_fisher ()
void
ncm_fit_obs_fisher (NcmFit *fit
);
Calculates the covariance from the observed Fisher
matrix, see ncm_fit_numdiff_m2lnL_covar()
.
ncm_fit_fisher ()
void
ncm_fit_fisher (NcmFit *fit
);
Calculates the covariance from the Fisher matrix, see
ncm_dataset_fisher_matrix()
.
ncm_fit_numdiff_m2lnL_hessian ()
void ncm_fit_numdiff_m2lnL_hessian (NcmFit *fit
,NcmMatrix *H
,gdouble reltol
);
Calculates the Hessian of $-2\ln(L)$ with respect to the free parameters.
ncm_fit_numdiff_m2lnL_covar ()
void
ncm_fit_numdiff_m2lnL_covar (NcmFit *fit
);
Calcualtes the covariance matrix using the inverse of the Hessian matrix $\partial_i\partial_j -\ln(L)$, where the derivatives are taken with respect to the free parameters.
ncm_fit_ls_covar ()
void
ncm_fit_ls_covar (NcmFit *fit
);
Computes the covariance matrix using the least squares method, and fills up the internal structure matrix.
ncm_fit_get_covar ()
NcmMatrix *
ncm_fit_get_covar (NcmFit *fit
);
Returns a copy of the covariance matrix (pre-calculated by, e.g, ncm_fit_numdiff_m2lnL_covar()
).
ncm_fit_covar_var ()
gdouble ncm_fit_covar_var (NcmFit *fit
,NcmModelID mid
,guint pid
);
Computes the variance of the fitted parameter pid
of the model mid
.
ncm_fit_covar_sd ()
gdouble ncm_fit_covar_sd (NcmFit *fit
,NcmModelID mid
,guint pid
);
Computes the standard deviation of the fitted parameter pid
of the model mid
.
ncm_fit_covar_cov ()
gdouble ncm_fit_covar_cov (NcmFit *fit
,NcmModelID mid1
,guint pid1
,NcmModelID mid2
,guint pid2
);
Computes the covariance between the parameters pid1
and pid2
of the models
mid1
and mid2
, respectively.
Parameters
fit |
a NcmFit |
|
mid1 |
||
pid1 |
the parameter's index of the model |
|
mid2 |
||
pid2 |
the parameter's index of the model |
ncm_fit_covar_cor ()
gdouble ncm_fit_covar_cor (NcmFit *fit
,NcmModelID mid1
,guint pid1
,NcmModelID mid2
,guint pid2
);
Computes the correlation between the parameters pid1
and pid2
of the models
mid1
and mid2
, respectively.
Parameters
fit |
a NcmFit |
|
mid1 |
||
pid1 |
the parameter's index of the model |
|
mid2 |
||
pid2 |
the parameter's index of the model |
ncm_fit_covar_fparam_var ()
gdouble ncm_fit_covar_fparam_var (NcmFit *fit
,guint fpi
);
Computes the variance of the fitted parameter fpi
.
This index refers to the list of all FREE parameters set in the MSet.
See also the similar function ncm_fit_covar_var()
to which one has to provide
the respective model of the parameter.
ncm_fit_covar_fparam_sd ()
gdouble ncm_fit_covar_fparam_sd (NcmFit *fit
,guint fpi
);
Computes the standard deviation of the fitted parameter fpi
.
This index refers to the list of all FREE parameters set in the MSet.
See also the similar function ncm_fit_covar_sd()
to which one has to provide
the respective model of the parameter.
ncm_fit_covar_fparam_cov ()
gdouble ncm_fit_covar_fparam_cov (NcmFit *fit
,guint fpi1
,guint fpi2
);
Computes the covariance between the fitted parameters fpi1
and fpi2
.
These indices refers to the list of all FREE parameters set in the MSet.
See also the similar function ncm_fit_covar_cov()
to which one has to provide
the respective models of the parameters.
ncm_fit_covar_fparam_cor ()
gdouble ncm_fit_covar_fparam_cor (NcmFit *fit
,guint fpi1
,guint fpi2
);
Computes the correlation between the fitted parameters fpi1
and fpi2
.
These indices refers to the list of all FREE parameters set in the MSet.
See also the similar function ncm_fit_covar_cor()
to which one has to provide
the respective models of the parameters.
ncm_fit_residual_ks_test ()
gdouble ncm_fit_residual_ks_test (NcmFit *fit
,gdouble *o_mean
,gdouble *o_sd
,gdouble *o_skew
,gdouble *o_kurtosis
,gdouble *o_max
);
FIXME
Parameters
fit |
a NcmFit. |
|
o_mean |
FIXME. |
[out] |
o_sd |
FIXME. |
[out] |
o_skew |
FIXME. |
[out] |
o_kurtosis |
FIXME. |
[out] |
o_max |
FIXME. |
[out] |
ncm_fit_lr_test_range ()
void ncm_fit_lr_test_range (NcmFit *fit
,NcmModelID mid
,guint pid
,gdouble start
,gdouble stop
,gdouble step
);
FIXME
ncm_fit_dprob ()
void ncm_fit_dprob (NcmFit *fit
,NcmModelID mid
,guint pid
,gdouble a
,gdouble b
,gdouble step
,gdouble norm
);
FIXME
ncm_fit_lr_test ()
gdouble ncm_fit_lr_test (NcmFit *fit
,NcmModelID mid
,guint pid
,gdouble val
,gint dof
);
FIXME
ncm_fit_prob ()
gdouble ncm_fit_prob (NcmFit *fit
,NcmModelID mid
,guint pid
,gdouble a
,gdouble b
);
FIXME
ncm_fit_run_restart ()
void ncm_fit_run_restart (NcmFit *fit
,NcmFitRunMsgs mtype
,const gdouble abstol
,const gdouble reltol
,NcmMSet *save_mset
,const gchar *mset_file
);
Re-runs the fit until the difference between fits are less than the required tolerance, i.e., $$ m2lnL_{i-1} - m2lnL_i < \mathrm{abstol} + \mathrm{reltol}\vert m2lnL_{i-1}\vert. $$
ncm_fit_type_constrain_error ()
gdouble ncm_fit_type_constrain_error (NcmFit *fit
,gdouble p
,gint nu
,gdouble dir
,NcmMSetFunc *func
,gdouble z
,gboolean walk
);
ncm_fit_function_error ()
void ncm_fit_function_error (NcmFit *fit
,NcmMSetFunc *func
,gdouble *x
,gboolean pretty_print
,gdouble *f
,gdouble *sigma_f
);
FIXME
ncm_fit_function_cov ()
gdouble ncm_fit_function_cov (NcmFit *fit
,NcmMSetFunc *func1
,gdouble z1
,NcmMSetFunc *func2
,gdouble z2
,gboolean pretty_print
);
FIXME
Property Details
The “equality-constraints”
property
“equality-constraints” NcmObjArray *
Equality constraints array.
Owner: NcmFit
Flags: Read / Write
The “equality-constraints-tot”
property
“equality-constraints-tot” NcmVector *
Equality constraints tolerance.
Owner: NcmFit
Flags: Read / Write
The “grad-type”
property
“grad-type” NcmFitGradType
Differentiation method.
Owner: NcmFit
Flags: Read / Write / Construct
Default value: NCM_FIT_GRAD_NUMDIFF_FORWARD
The “inequality-constraints”
property
“inequality-constraints” NcmObjArray *
Inequality constraints array.
Owner: NcmFit
Flags: Read / Write
The “inequality-constraints-tot”
property
“inequality-constraints-tot” NcmVector *
Inequality constraints tolerance.
Owner: NcmFit
Flags: Read / Write
The “likelihood”
property
“likelihood” NcmLikelihood *
Likelihood object.
Owner: NcmFit
Flags: Read / Write / Construct Only
The “m2lnL-abstol”
property
“m2lnL-abstol” double
Absolute tolarence in m2lnL.
Owner: NcmFit
Flags: Read / Write / Construct
Allowed values: >= 0
Default value: 0
The “m2lnL-reltol”
property
“m2lnL-reltol” double
Relative tolarence in m2lnL.
Owner: NcmFit
Flags: Read / Write / Construct
Allowed values: >= 0
Default value: 1e-08
The “maxiter”
property
“maxiter” guint
Maximum number of interations.
Owner: NcmFit
Flags: Read / Write / Construct
Default value: 100000
The “mset”
property
“mset” NcmMSet *
Model set object.
Owner: NcmFit
Flags: Read / Write / Construct Only
The “params-reltol”
property
“params-reltol” double
Relative tolarence in fitted parameters.
Owner: NcmFit
Flags: Read / Write / Construct
Allowed values: >= 0
Default value: 1e-05
The “state”
property
“state” NcmFitState *
Fit state object.
Owner: NcmFit
Flags: Read / Write / Construct Only