NcmMSet

NcmMSet — A set of different NcmModel objects.

Functions

#define NCM_MSET_GET_BASE_MID()
#define NCM_MSET_MID()
void ncm_mset_model_register_id ()
#define NCM_MSET_MODEL_ID_FUNC()
#define NCM_MSET_MODEL_DECLARE_ID()
#define NCM_MSET_MODEL_REGISTER_ID()
NcmMSetPIndex * ncm_mset_pindex_new ()
NcmMSetPIndex * ncm_mset_pindex_dup ()
void ncm_mset_pindex_free ()
gboolean ncm_mset_split_full_name ()
NcmMSet * ncm_mset_empty_new ()
NcmMSet * ncm_mset_new ()
NcmMSet * ncm_mset_newv ()
NcmMSet * ncm_mset_new_array ()
NcmMSet * ncm_mset_ref ()
NcmMSet * ncm_mset_dup ()
NcmMSet * ncm_mset_shallow_copy ()
void ncm_mset_free ()
void ncm_mset_clear ()
NcmModel * ncm_mset_peek ()
NcmModel * ncm_mset_peek_pos ()
NcmModel * ncm_mset_get ()
NcmModel * ncm_mset_peek_array_pos ()
NcmModel * ncm_mset_peek_by_name ()
NcmModelID ncm_mset_get_mid_array_pos ()
void ncm_mset_remove ()
void ncm_mset_set ()
void ncm_mset_push ()
void ncm_mset_set_pos ()
gboolean ncm_mset_exists ()
gboolean ncm_mset_exists_pos ()
gboolean ncm_mset_is_subset ()
gint ncm_mset_cmp_all ()
NcmModelID ncm_mset_get_id_by_type ()
NcmModelID ncm_mset_get_id_by_ns ()
const gchar * ncm_mset_get_ns_by_id ()
GType ncm_mset_get_type_by_id ()
void ncm_mset_set_fmap ()
gchar ** ncm_mset_get_fmap ()
void ncm_mset_prepare_fparam_map ()
gboolean ncm_mset_fparam_map_valid ()
guint ncm_mset_total_len ()
guint ncm_mset_fparam_len ()
guint ncm_mset_max_param_name ()
guint ncm_mset_max_fparam_name ()
guint ncm_mset_max_model_nick ()
guint ncm_mset_nmodels ()
void ncm_mset_pretty_log ()
void ncm_mset_params_pretty_print ()
void ncm_mset_params_log_vals ()
void ncm_mset_params_print_vals ()
void ncm_mset_fparams_log_covar ()
gboolean ncm_mset_params_valid ()
gboolean ncm_mset_params_valid_bounds ()
gboolean ncm_mset_cmp ()
void ncm_mset_param_set ()
void ncm_mset_param_set0 ()
gdouble ncm_mset_param_get ()
gdouble ncm_mset_orig_param_get ()
const gchar * ncm_mset_param_name ()
const gchar * ncm_mset_param_symbol ()
void ncm_mset_param_set_ftype ()
void ncm_mset_param_set_all_ftype ()
void ncm_mset_param_set_mid_ftype ()
void ncm_mset_param_set_all_but_mid_ftype ()
void ncm_mset_param_set_ftype_from_fmap ()
void ncm_mset_param_set_vector ()
void ncm_mset_param_get_vector ()
void ncm_mset_param_set_mset ()
gdouble ncm_mset_param_get_scale ()
gdouble ncm_mset_param_get_lower_bound ()
gdouble ncm_mset_param_get_upper_bound ()
gdouble ncm_mset_param_get_abstol ()
NcmParamType ncm_mset_param_get_ftype ()
void ncm_mset_param_set_scale ()
void ncm_mset_param_set_pi ()
void ncm_mset_param_get_pi ()
void ncm_mset_fparams_get_vector ()
void ncm_mset_fparams_get_vector_offset ()
void ncm_mset_fparams_set_vector ()
void ncm_mset_fparams_set_vector_offset ()
void ncm_mset_fparams_set_array ()
void ncm_mset_fparams_set_gsl_vector ()
guint ncm_mset_fparams_len ()
const gchar * ncm_mset_fparam_name ()
const gchar * ncm_mset_fparam_symbol ()
const gchar * ncm_mset_fparam_full_name ()
NcmMSetPIndex * ncm_mset_param_get_by_full_name ()
gdouble ncm_mset_fparam_get_scale ()
gdouble ncm_mset_fparam_get_lower_bound ()
gdouble ncm_mset_fparam_get_upper_bound ()
NcmMatrix * ncm_mset_fparam_get_bound_matrix ()
gdouble ncm_mset_fparam_get_abstol ()
void ncm_mset_fparam_set_scale ()
gboolean ncm_mset_fparam_valid_bounds ()
gboolean ncm_mset_fparam_valid_bounds_offset ()
gboolean ncm_mset_fparam_validate_all ()
gdouble ncm_mset_fparam_get ()
void ncm_mset_fparam_set ()
const NcmMSetPIndex * ncm_mset_fparam_get_pi ()
gint ncm_mset_fparam_get_fpi ()
const NcmMSetPIndex * ncm_mset_fparam_get_pi_by_name ()
void ncm_mset_save ()
NcmMSet * ncm_mset_load ()

Properties

GStrv fmap Read / Write
NcmObjArray * model-array Read / Write / Construct
gboolean valid-map Read / Write

Types and Values

Object Hierarchy

    GBoxed
    ╰── NcmMSetPIndex
    GObject
    ╰── NcmMSet

Description

A NcmMSet is a set of different NcmModel objects. It is used to represent a set of models that can be used to fit a data set.

When the model class is created the class method ncm_mset_model_register_id() must be used to register the model class. This function must be used once and only once in the model class definition. Any subclasse of the model class will inherit the model id. The same compilation unit must call the macro NCM_MSET_MODEL_REGISTER_ID() for each model class that will be used in the NcmMSet. It should also include NCM_MSET_MODEL_DECLARE_ID() in the header file.

Models can be stackable or not. If a model is stackable, the NcmMSet can contain more than one instance of the same model. If a model is not stackable, the NcmMSet can contain only one instance of the model.

The model can be a submodel of another model. In this case, the model class must set the main_model_id field to the model id of the parent model. If it is the main model, the main_model_id must be set to NCM_MSET_MODEL_MAIN().

The NcmMSet can be created empty or with a list of models. The stackable models can be added to the NcmMSet using the function ncm_mset_push() to add the model to the end of the list or using ncm_mset_set_pos() to add the model in a specific position. The non-stackable models can be added using ncm_mset_set(). For both ncm_mset_set_pos() and ncm_mset_set() if there is already a model in the position it will be replaced.

Functions

NCM_MSET_GET_BASE_MID()

#define NCM_MSET_GET_BASE_MID(mid) (mid / NCM_MSET_MAX_STACKSIZE)

NCM_MSET_MID()

#define NCM_MSET_MID(id, pos) ((id) + pos)

ncm_mset_model_register_id ()

void
ncm_mset_model_register_id (NcmModelClass *model_class,
                            const gchar *ns,
                            const gchar *desc,
                            const gchar *long_desc,
                            gboolean can_stack,
                            NcmModelID main_model_id);

Register a model class in the NcmMSet. This function must be used once and only once in the model class definition. Any subclasse of the model class will inherit the model id. The same compilation unit must call the macro NCM_MSET_MODEL_REGISTER_ID() for each model class that will be used in the NcmMSet. It should also include NCM_MSET_MODEL_DECLARE_ID() in the header file.

If can_stack is TRUE, the models can stack in a NcmMSet. If can_stack is FALSE, the NcmMSet can contain only one instance of the model class or any of its subclasses.

If main_model_id is NCM_MSET_MODEL_MAIN(), this is a main model. If main_model_id is not NCM_MSET_MODEL_MAIN(), this must be the id of the main model. This is used to define an hierarchy of models. For example, the model class NcHIPrim is a submodel of NcHICosmo. The main model of NcHIPrim is NcHICosmo. Thus, each instance of NcHICosmo can contain one instance of NcHIPrim.

[skip]

Parameters

model_class

a NcmModelClass

 

ns

model namespace

 

desc

short description

 

long_desc

long description

 

can_stack

whether the models can stack in a NcmMSet

 

main_model_id

main model id, use -1 if this is a main model

 

NCM_MSET_MODEL_ID_FUNC()

#define NCM_MSET_MODEL_ID_FUNC(model_ns) model_ns ## _id

Defines a function to get the model id from the model namespace.

Parameters

model_ns

model namespace in snake case

 

NCM_MSET_MODEL_DECLARE_ID()

#define NCM_MSET_MODEL_DECLARE_ID(model_ns) NcmModelID NCM_MSET_MODEL_ID_FUNC (model_ns) (void) G_GNUC_CONST

Declares a function to get the model id from the model namespace. This macro should be used in the header file of the model.

Parameters

model_ns

model namespace in snake case

 

NCM_MSET_MODEL_REGISTER_ID()

#define             NCM_MSET_MODEL_REGISTER_ID(model_ns, typemacro)

Defines the function to get the model id from the model namespace. This macro should be used in the source file of the model.

Parameters

model_ns

model namespace in snake case

 

typemacro

macro that returns the GType of the model

 

ncm_mset_pindex_new ()

NcmMSetPIndex *
ncm_mset_pindex_new (NcmModelID mid,
                     guint pid);

Creates a new NcmMSetPIndex.

Parameters

mid

Model id

 

pid

Parameter id

 

Returns

a new NcmMSetPIndex.

[transfer full]


ncm_mset_pindex_dup ()

NcmMSetPIndex *
ncm_mset_pindex_dup (NcmMSetPIndex *pi);

Duplicate a NcmMSetPIndex.

Parameters

pi

a NcmMSetPIndex

 

Returns

a new NcmMSetPIndex with the same values of pi .

[transfer full]


ncm_mset_pindex_free ()

void
ncm_mset_pindex_free (NcmMSetPIndex *pi);

Free a NcmMSetPIndex.

Parameters

pi

a NcmMSetPIndex

 

ncm_mset_split_full_name ()

gboolean
ncm_mset_split_full_name (const gchar *fullname,
                          gchar **model_ns,
                          guint *stackpos_id,
                          gchar **pname);

Splits the fullname into model_ns , stackpos_id and pname . The fullname should be specified with the parameter full name "model:parameter_name" or "model:stackposition:parameter_name".

Parameters

fullname

full name of a parameter

 

model_ns

model namespace.

[out][transfer full]

stackpos_id

stack position id.

[out]

pname

parameter name.

[out][transfer full]

Returns

TRUE if the fullname is valid, FALSE otherwise.


ncm_mset_empty_new ()

NcmMSet *
ncm_mset_empty_new (void);

Creates a new empty NcmMSet.

Returns

a new empty NcmMSet.

[transfer full]


ncm_mset_new ()

NcmMSet *
ncm_mset_new (gpointer model0,
              ...);

Creates a new NcmMSet with the models passed as arguments.

Parameters

model0

a NcmModel

 

...

a null terminated list of NcmModel

 

Returns

a new NcmMSet.

[transfer full]


ncm_mset_newv ()

NcmMSet *
ncm_mset_newv (gpointer model0,
               va_list ap);

Creates a new NcmMSet with the models passed as arguments.

Parameters

model0

a NcmModel

 

ap

a va_list

 

Returns

a new NcmMSet.

[transfer full]


ncm_mset_new_array ()

NcmMSet *
ncm_mset_new_array (GPtrArray *model_array);

Creates a new NcmMSet with the models passed as arguments.

Parameters

model_array

a GPtrArray of NcmModel.

[array][element-type NcmModel]

Returns

a new NcmMSet.

[transfer full]


ncm_mset_ref ()

NcmMSet *
ncm_mset_ref (NcmMSet *mset);

Increases the reference count of mset by one.

Parameters

mset

a NcmMSet

 

Returns

a new NcmMSet.

[transfer full]


ncm_mset_dup ()

NcmMSet *
ncm_mset_dup (NcmMSet *mset,
              NcmSerialize *ser);

Duplicate a NcmMSet using a NcmSerialize object.

Parameters

mset

a NcmMSet

 

ser

a NcmSerialize

 

Returns

a new NcmMSet.

[transfer full]


ncm_mset_shallow_copy ()

NcmMSet *
ncm_mset_shallow_copy (NcmMSet *mset);

Creates a new NcmMSet with the same models of mset .

Parameters

mset

a NcmMSet

 

Returns

a new NcmMSet.

[transfer full]


ncm_mset_free ()

void
ncm_mset_free (NcmMSet *mset);

Atomically decreases the reference count of mset by one. If the reference count drops to 0, all memory allocated by mset is released.

Parameters

mset

a NcmMSet

 

ncm_mset_clear ()

void
ncm_mset_clear (NcmMSet **mset);

If *mse is not NULL, decreases the reference count of mset by one. If the reference count drops to 0, all memory allocated by mset is released and *mset is set to NULL.

Parameters

mset

a NcmMSet

 

ncm_mset_peek ()

NcmModel *
ncm_mset_peek (NcmMSet *mset,
               NcmModelID mid);

Peeks a NcmModel from the NcmMSet using the model id mid .

Parameters

mset

a NcmMSet

 

mid

a NcmModelID

 

Returns

a NcmModel with the model id mid .

[transfer none]


ncm_mset_peek_pos ()

NcmModel *
ncm_mset_peek_pos (NcmMSet *mset,
                   NcmModelID base_mid,
                   guint stackpos_id);

Peeks a NcmModel from the NcmMSet using the model id base_mid and stack position stackpos_id . This function is useful when the model is stackable.

Parameters

mset

a NcmMSet

 

base_mid

a NcmModelID

 

stackpos_id

position in the stack

 

Returns

a NcmModel with the model id base_mid + stackpos_id .

[transfer none]


ncm_mset_get ()

NcmModel *
ncm_mset_get (NcmMSet *mset,
              NcmModelID mid);

Gets a NcmModel from the NcmMSet using the model id mid .

Parameters

mset

a NcmMSet

 

mid

a NcmModelID

 

Returns

a NcmModel with the model id mid .

[transfer full]


ncm_mset_peek_array_pos ()

NcmModel *
ncm_mset_peek_array_pos (NcmMSet *mset,
                         guint i);

Peeks a NcmModel from the NcmMSet using the array position i . The array position is not guaranteed to be the same for different NcmMSet objects. This function is useful to iterate over the models in the NcmMSet.

Parameters

mset

a NcmMSet

 

i

array position

 

Returns

a NcmModel with the array position i .

[transfer none]


ncm_mset_peek_by_name ()

NcmModel *
ncm_mset_peek_by_name (NcmMSet *mset,
                       const gchar *name);

Peeks a NcmModel from the NcmMSet using the model namespace name . The name may be specified with the parameter full name "model:stackposition". If the stack position is not specified, the first model with the model namespace name will be returned.

Parameters

mset

a NcmMSet

 

name

model namespace

 

Returns

a NcmModel with the model namespace name .

[transfer none]


ncm_mset_get_mid_array_pos ()

NcmModelID
ncm_mset_get_mid_array_pos (NcmMSet *mset,
                            guint i);

Gets the model id of the model in the array position i . The array position is not guaranteed to be the same for different NcmMSet objects. This function is useful to iterate over the models in the NcmMSet.

Parameters

mset

a NcmMSet

 

i

array position

 

Returns

a NcmModelID with the array position i .


ncm_mset_remove ()

void
ncm_mset_remove (NcmMSet *mset,
                 NcmModelID mid);

Removes a NcmModel from the NcmMSet using the model id mid .

Parameters

mset

a NcmMSet

 

mid

a NcmModelID

 

ncm_mset_set ()

void
ncm_mset_set (NcmMSet *mset,
              NcmModel *model);

Sets a NcmModel in the NcmMSet. If there is already a model with the same model id, it will be replaced. If it is a stackable model, it will be added to the first position.

Parameters

mset

a NcmMSet

 

model

a NcmModel

 

ncm_mset_push ()

void
ncm_mset_push (NcmMSet *mset,
               NcmModel *model);

Pushes a NcmModel to the end of the NcmMSet. If the model is not stackable, it will be added to the first position, if there is already a model with the same model id an error will be raised.

Parameters

mset

a NcmMSet

 

model

a NcmModel

 

ncm_mset_set_pos ()

void
ncm_mset_set_pos (NcmMSet *mset,
                  NcmModel *model,
                  guint stackpos_id);

Sets a NcmModel in the NcmMSet in the stack position stackpos_id . If there is already a model with the same model id, it will be replaced. If it is a stackable model, it will be added to the position stackpos_id . If stackpos_id is 0, it will be added to the first position.

If the model is not stackable, it will raise an error if stackpos_id is different from 0.

Parameters

mset

a NcmMSet

 

model

a NcmModel

 

stackpos_id

stack position

 

ncm_mset_exists ()

gboolean
ncm_mset_exists (NcmMSet *mset,
                 NcmModel *model);

Tests whether a NcmModel exists in the NcmMSet.

Parameters

mset

a NcmMSet

 

model

a NcmModel

 

Returns

TRUE if model exists in mset , FALSE otherwise.


ncm_mset_exists_pos ()

gboolean
ncm_mset_exists_pos (NcmMSet *mset,
                     NcmModel *model,
                     guint stackpos_id);

Checks whether a NcmModel with the same id as model and stack position stackpos_id exists in the NcmMSet.

Parameters

mset

a NcmMSet

 

model

a NcmModel

 

stackpos_id

stack position

 

Returns

TRUE if model exists in mset , FALSE otherwise.


ncm_mset_is_subset ()

gboolean
ncm_mset_is_subset (NcmMSet *mset,
                    NcmMSet *sub_mset);

Checks whether sub_mset is a subset of mset , that is, whether all models in sub_mset are also in mset .

Parameters

mset

a NcmMSet

 

sub_mset

a NcmMSet

 

Returns

TRUE if sub_mset is a subset of mset , FALSE otherwise.


ncm_mset_cmp_all ()

gint
ncm_mset_cmp_all (NcmMSet *mset0,
                  NcmMSet *mset1);

Compares two NcmMSet objects. It returns 0 if they contain the same models, with the same number of parameters, in the same order. It returns -1 if mset0 has fewer models than mset1 , or if they have the same number of models but mset0 has a model with fewer parameters than the corresponding model in mset1 . It returns 1 if mset0 has more models than mset1 , or if they have the same number of models but mset0 has a model with more parameters than the corresponding model in mset1 .

Parameters

mset0

a NcmMSet

 

mset1

a NcmMSet

 

Returns

the comparison result.


ncm_mset_get_id_by_type ()

NcmModelID
ncm_mset_get_id_by_type (GType model_type);

Gets the model id for a model type in the GObject type system.

Parameters

model_type

a GType

 

Returns

the model id for model_type , or -1 if model_type is not a NcmModel.


ncm_mset_get_id_by_ns ()

NcmModelID
ncm_mset_get_id_by_ns (const gchar *ns);

Gets the model id for a model namespace.

Parameters

ns

a string containing the model namespace

 

Returns

the model id for ns , or -1 if ns is not a registered model namespace.


ncm_mset_get_ns_by_id ()

const gchar *
ncm_mset_get_ns_by_id (NcmModelID id);

Parameters

id

namespace id

 

Returns

namespace for id .

[transfer none]


ncm_mset_get_type_by_id ()

GType
ncm_mset_get_type_by_id (NcmModelID id);

Parameters

id

namespace id

 

Returns

GType of model id


ncm_mset_set_fmap ()

void
ncm_mset_set_fmap (NcmMSet *mset,
                   const gchar * const *fmap,
                   gboolean update_models);

Sets the free parameters map for mset . This function must be called before any other function that uses the free parameters map. The fmap array must be zero-terminated and contain the full names of the free parameters in mset .

Parameters

mset

a NcmMSet

 

fmap

an array of strings.

[in][array zero-terminated=1][element-type utf8]

update_models

a boolean

 

ncm_mset_get_fmap ()

gchar **
ncm_mset_get_fmap (NcmMSet *mset);

Gets the free parameters map for mset . The returned array must be freed with g_strfreev(). It contains the full names of the free parameters in mset .

Parameters

mset

a NcmMSet

 

Returns

an array of strings.

[transfer full][array zero-terminated=1][element-type utf8]


ncm_mset_prepare_fparam_map ()

void
ncm_mset_prepare_fparam_map (NcmMSet *mset);

Computes the free parameters map for mset . This function must be called before any other function that uses the free parameters map.

Parameters

mset

a NcmMSet

 

ncm_mset_fparam_map_valid ()

gboolean
ncm_mset_fparam_map_valid (NcmMSet *mset);

Checks whether the free parameters map for mset is valid.

Parameters

mset

a NcmMSet

 

Returns

TRUE if the free parameters map for mset is valid, FALSE otherwise.


ncm_mset_total_len ()

guint
ncm_mset_total_len (NcmMSet *mset);

Gets the total number of parameters in mset (including fixed and free parameters).

Parameters

mset

a NcmMSet

 

Returns

Total number of parameters in mset .


ncm_mset_fparam_len ()

guint
ncm_mset_fparam_len (NcmMSet *mset);

Gets the number of free parameters in mset .

Parameters

mset

a NcmMSet

 

Returns

Number of free parameters in mset .


ncm_mset_max_param_name ()

guint
ncm_mset_max_param_name (NcmMSet *mset);

Gets the maximum length of the parameter names in mset . This function is useful to print the parameters in a pretty way.

Parameters

mset

a NcmMSet

 

Returns

Maximum length of the parameter names in mset .


ncm_mset_max_fparam_name ()

guint
ncm_mset_max_fparam_name (NcmMSet *mset);

Gets the maximum length of the free parameter names in mset . This function is useful to print the parameters in a pretty way.

Parameters

mset

a NcmMSet

 

Returns

Maximum length of the free parameter names in mset .


ncm_mset_max_model_nick ()

guint
ncm_mset_max_model_nick (NcmMSet *mset);

Gets the maximum length of the model nick in mset . This function is useful to print the models in a pretty way.

Parameters

mset

a NcmMSet

 

Returns

Maximum length of the model nick in mset .


ncm_mset_nmodels ()

guint
ncm_mset_nmodels (NcmMSet *mset);

Gets the number of models in mset .

Parameters

mset

a NcmMSet

 

Returns

Number of models in mset .


ncm_mset_pretty_log ()

void
ncm_mset_pretty_log (NcmMSet *mset);

This function prints the contents of mset . It prints the model nick and parameters' names and their values indicating if they are fixed or free.

Parameters

mset

a NcmMSet

 

ncm_mset_params_pretty_print ()

void
ncm_mset_params_pretty_print (NcmMSet *mset,
                              FILE *out,
                              const gchar *header);

This function print the command line (first line, commented), the model nick and parameters' names (second line, commented) and their values indicating if they are fixed or free.

Parameters

mset

a NcmMSet

 

out

name of the file

 

header

pointer to the command line

 

ncm_mset_params_log_vals ()

void
ncm_mset_params_log_vals (NcmMSet *mset);

Logs the values of the parameters in mset .

Parameters

mset

a NcmMSet

 

ncm_mset_params_print_vals ()

void
ncm_mset_params_print_vals (NcmMSet *mset,
                            FILE *out);

Prints the values of the parameters in mset in the file out .

Parameters

mset

a NcmMSet

 

out

a FILE handler

 

ncm_mset_fparams_log_covar ()

void
ncm_mset_fparams_log_covar (NcmMSet *mset,
                            NcmMatrix *covar);

Logs the covariance matrix of the free parameters in mset . The covariance matrix is assumed to be in the same order as the free parameters in mset and must be square and with the same size as the number of free parameters ncm_mset_fparam_len().

Parameters

mset

a NcmMSet

 

covar

a NcmMatrix

 

ncm_mset_params_valid ()

gboolean
ncm_mset_params_valid (NcmMSet *mset);

Check whenever all models in mset have valid parameters.

Parameters

mset

a NcmMSet

 

Returns

If TRUE all models have valid parameters.


ncm_mset_params_valid_bounds ()

gboolean
ncm_mset_params_valid_bounds (NcmMSet *mset);

Check whenever the parameters respect the bounds.

Parameters

mset

a NcmMSet

 

Returns

If TRUE the parameter respect the bounds.


ncm_mset_cmp ()

gboolean
ncm_mset_cmp (NcmMSet *mset0,
              NcmMSet *mset1,
              gboolean cmp_model);

Compares mset0 and mset1 and returns TRUE if both contains the same models types. If cmp_model is TRUE compare also if the models correspond to the same objects types.

Parameters

mset0

a NcmMSet

 

mset1

a NcmMSet

 

cmp_model

whether to compare if the models correspond to the same objects

 

Returns

TRUE if mset0 == mset1 .


ncm_mset_param_set ()

void
ncm_mset_param_set (NcmMSet *mset,
                    NcmModelID mid,
                    guint pid,
                    const gdouble x);

Sets the value of the parameter pid in the model mid to x . This function updates the model parameters.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

x

the value to set

 

ncm_mset_param_set0 ()

void
ncm_mset_param_set0 (NcmMSet *mset,
                     NcmModelID mid,
                     guint pid,
                     const gdouble x);

Sets the value of the parameter pid in the model mid to x . This function does not update the model parameters. It is useful when the parameters are being updated in a loop and the model parameters are updated only once, after the loop.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

x

the value to set

 

ncm_mset_param_get ()

gdouble
ncm_mset_param_get (NcmMSet *mset,
                    NcmModelID mid,
                    guint pid);

Gets the value of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the value of the parameter pid in the model mid .


ncm_mset_orig_param_get ()

gdouble
ncm_mset_orig_param_get (NcmMSet *mset,
                         NcmModelID mid,
                         guint pid);

Gets the value of the original parameter pid in the model mid . That is the value of the parameter before any reparametrization.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the value of the original parameter pid in the model mid .


ncm_mset_param_name ()

const gchar *
ncm_mset_param_name (NcmMSet *mset,
                     NcmModelID mid,
                     guint pid);

Gets the name of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the name of the parameter pid in the model mid .


ncm_mset_param_symbol ()

const gchar *
ncm_mset_param_symbol (NcmMSet *mset,
                       NcmModelID mid,
                       guint pid);

Gets the symbol of the parameter pid in the model mid . The parameter symbol is a string that represents the parameter using LaTeX symbols.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the symbol of the parameter pid in the model mid .


ncm_mset_param_set_ftype ()

void
ncm_mset_param_set_ftype (NcmMSet *mset,
                          NcmModelID mid,
                          guint pid,
                          NcmParamType ftype);

Sets the type of the parameter pid in the model mid to ftype . The parameter type can be fixed (NCM_PARAM_TYPE_FIXED) or free (NCM_PARAM_TYPE_FREE).

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

ftype

a NcmParamType

 

ncm_mset_param_set_all_ftype ()

void
ncm_mset_param_set_all_ftype (NcmMSet *mset,
                              NcmParamType ftype);

Set all parameters of all models to ftype .

Parameters

mset

a NcmMSet

 

ftype

a NcmParamType

 

ncm_mset_param_set_mid_ftype ()

void
ncm_mset_param_set_mid_ftype (NcmMSet *mset,
                              NcmModelID mid,
                              NcmParamType ftype);

Set all parameters of mid model to ftype .

Parameters

mset

a NcmMSet

 

mid

model id

 

ftype

a NcmParamType

 

ncm_mset_param_set_all_but_mid_ftype ()

void
ncm_mset_param_set_all_but_mid_ftype (NcmMSet *mset,
                                      NcmModelID mid,
                                      NcmParamType ftype);

Set all parameters of all models but mid to ftype .

Parameters

mset

a NcmMSet

 

mid

model id

 

ftype

a NcmParamType

 

ncm_mset_param_set_ftype_from_fmap ()

void
ncm_mset_param_set_ftype_from_fmap (NcmMSet *mset);

Set all parameters of all models inside mset in order to reflect the current fmap.

Parameters

mset

a NcmMSet

 

ncm_mset_param_set_vector ()

void
ncm_mset_param_set_vector (NcmMSet *mset,
                           NcmVector *params);

Sets the models parameters using values from the NcmVector params .

Parameters

mset

a NcmMSet

 

params

a NcmVector

 

ncm_mset_param_get_vector ()

void
ncm_mset_param_get_vector (NcmMSet *mset,
                           NcmVector *params);

Sets the compontents of params using the models parameters.

Parameters

mset

a NcmMSet

 

params

a NcmVector

 

ncm_mset_param_set_mset ()

void
ncm_mset_param_set_mset (NcmMSet *mset_dest,
                         NcmMSet *mset_src);

Copy parameters from mset_src to mset_dest , both NcmMSet must be compatible.

Parameters

mset_dest

a NcmMSet

 

mset_src

a NcmMSet

 

ncm_mset_param_get_scale ()

gdouble
ncm_mset_param_get_scale (NcmMSet *mset,
                          NcmModelID mid,
                          guint pid);

Gets the scale of the parameter pid in the model mid . This scale is a value that is used as a starting guess for the variation of the parameter in a statistical analysis.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the scale of the parameter pid in the model mid .


ncm_mset_param_get_lower_bound ()

gdouble
ncm_mset_param_get_lower_bound (NcmMSet *mset,
                                NcmModelID mid,
                                guint pid);

Gets the lower bound of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the lower bound of the parameter pid in the model mid .


ncm_mset_param_get_upper_bound ()

gdouble
ncm_mset_param_get_upper_bound (NcmMSet *mset,
                                NcmModelID mid,
                                guint pid);

Gets the upper bound of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the upper bound of the parameter pid in the model mid .


ncm_mset_param_get_abstol ()

gdouble
ncm_mset_param_get_abstol (NcmMSet *mset,
                           NcmModelID mid,
                           guint pid);

Gets the absolute tolerance of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

Returns

the absolute tolerance of the parameter pid in the model mid .


ncm_mset_param_get_ftype ()

NcmParamType
ncm_mset_param_get_ftype (NcmMSet *mset,
                          NcmModelID mid,
                          guint pid);

Gets the type NcmParamType of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

a NcmModelID

 

pid

parameter id

 

Returns

the type NcmParamType of the parameter pid in the model mid .


ncm_mset_param_set_scale ()

void
ncm_mset_param_set_scale (NcmMSet *mset,
                          NcmModelID mid,
                          guint pid,
                          gdouble scale);

Sets the scale of the parameter pid in the model mid to scale . This scale is a value that is used as a starting guess for the variation of the parameter in a statistical analysis.

Parameters

mset

a NcmMSet

 

mid

model id

 

pid

parameter id

 

scale

new scale

 

ncm_mset_param_set_pi ()

void
ncm_mset_param_set_pi (NcmMSet *mset,
                       NcmMSetPIndex *pi,
                       const gdouble *x,
                       guint n);

Sets the values of the parameters in mset using the values in x . The parameters are identified by the NcmMSetPIndex pi . This array and x must have the same size n .

Parameters

mset

a NcmMSet

 

pi

a NcmMSetPIndex array.

[array length=n][element-type NcmMSetPIndex]

x

values to be set.

[array length=n][element-type double]

n

number of parameters to set

 

ncm_mset_param_get_pi ()

void
ncm_mset_param_get_pi (NcmMSet *mset,
                       NcmMSetPIndex *pi,
                       gdouble *x,
                       guint n);

Gets the values of the parameters in mset and stores them in x . The parameters are identified by the NcmMSetPIndex pi . This array and x must have the same size n .

Parameters

mset

a NcmMSet

 

pi

a NcmMSetPIndex array.

[array length=n][element-type NcmMSetPIndex]

x

array to store the values.

[array length=n][element-type double]

n

number of parameters to get

 

ncm_mset_fparams_get_vector ()

void
ncm_mset_fparams_get_vector (NcmMSet *mset,
                             NcmVector *x);

Gets the free parameters of mset and stores them in x . The size of x must be equal to the number of free parameters in mset ncm_mset_fparams_len().

Parameters

mset

a NcmMSet

 

x

a NcmVector

 

ncm_mset_fparams_get_vector_offset ()

void
ncm_mset_fparams_get_vector_offset (NcmMSet *mset,
                                    NcmVector *x,
                                    guint offset);

Gets the free parameters of mset and stores them in x starting at offset . The size of x must be equal to the number of free parameters in mset ncm_mset_fparams_len() plus offset .

Parameters

mset

a NcmMSet

 

x

a NcmVector

 

offset

starting index

 

ncm_mset_fparams_set_vector ()

void
ncm_mset_fparams_set_vector (NcmMSet *mset,
                             const NcmVector *x);

Sets the free parameters of mset using the values of x . The size of x must be equal to the number of free parameters in mset ncm_mset_fparams_len().

Parameters

mset

a NcmMSet

 

x

a NcmVector

 

ncm_mset_fparams_set_vector_offset ()

void
ncm_mset_fparams_set_vector_offset (NcmMSet *mset,
                                    const NcmVector *x,
                                    guint offset);

Set the free parameters of mset using the values of x starting at offset .

Parameters

mset

a NcmMSet

 

x

a NcmVector

 

offset

starting index

 

ncm_mset_fparams_set_array ()

void
ncm_mset_fparams_set_array (NcmMSet *mset,
                            const gdouble *x);

Sets the free parameters of mset using the values of x . The size of x must be equal to the number of free parameters in mset ncm_mset_fparams_len(). Otherwise the behaviour is undefined.

Parameters

mset

a NcmMSet

 

x

array with the values.

[array][element-type double]

ncm_mset_fparams_set_gsl_vector ()

void
ncm_mset_fparams_set_gsl_vector (NcmMSet *mset,
                                 const gsl_vector *x);

Sets the free parameters of mset using the values of x . The size of x must be equal to the number of free parameters in mset ncm_mset_fparams_len().

[skip]

Parameters

mset

a NcmMSet.

 

x

a gsl_vector.

 

ncm_mset_fparams_len ()

guint
ncm_mset_fparams_len (NcmMSet *mset);

Gets the number of free parameters in mset .

Parameters

mset

a NcmMSet

 

Returns

the number of free parameters in mset .


ncm_mset_fparam_name ()

const gchar *
ncm_mset_fparam_name (NcmMSet *mset,
                      guint n);

Gets the name of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the name of the n -th free parameter.

[transfer none]


ncm_mset_fparam_symbol ()

const gchar *
ncm_mset_fparam_symbol (NcmMSet *mset,
                        guint n);

Gets the symbol of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the symbol of the n -th free parameter.

[transfer none]


ncm_mset_fparam_full_name ()

const gchar *
ncm_mset_fparam_full_name (NcmMSet *mset,
                           guint n);

Gets the full name of the n -th free parameter. That is the name of the model, the stack position and the parameter name.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the full name of the n -th free parameter.

[transfer none]


ncm_mset_param_get_by_full_name ()

NcmMSetPIndex *
ncm_mset_param_get_by_full_name (NcmMSet *mset,
                                 const gchar *fullname);

Gets the NcmMSetPIndex of the parameter identified by fullname . The fullname must be in the form "model:stackpos:param_name" when the model has a stack or "model:param_name" when the model has no stack.

Parameters

mset

a NcmMSet

 

fullname

param's full name

 

Returns

the NcmMSetPIndex of the parameter identified by fullname .

[transfer full]


ncm_mset_fparam_get_scale ()

gdouble
ncm_mset_fparam_get_scale (NcmMSet *mset,
                           guint n);

Gets the scale of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the scale of the n -th free parameter.


ncm_mset_fparam_get_lower_bound ()

gdouble
ncm_mset_fparam_get_lower_bound (NcmMSet *mset,
                                 guint n);

Gets the lower bound of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the lower bound of the n -th free parameter.


ncm_mset_fparam_get_upper_bound ()

gdouble
ncm_mset_fparam_get_upper_bound (NcmMSet *mset,
                                 guint n);

Gets the upper bound of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the upper bound of the n -th free parameter.


ncm_mset_fparam_get_bound_matrix ()

NcmMatrix *
ncm_mset_fparam_get_bound_matrix (NcmMSet *mset);

Gets a matrix with the lower and upper bounds of all free parameters. The returned matrix has two columns, the first column contains the lower bounds and the second column contains the upper bounds. The number of rows is equal to the number of free parameters in mset .

Parameters

mset

a NcmMSet

 

Returns

a matrix with the lower and upper bounds of all free parameters.

[transfer full]


ncm_mset_fparam_get_abstol ()

gdouble
ncm_mset_fparam_get_abstol (NcmMSet *mset,
                            guint n);

Gets the absolute tolerance of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the absolute tolerance of the n -th free parameter.


ncm_mset_fparam_set_scale ()

void
ncm_mset_fparam_set_scale (NcmMSet *mset,
                           guint n,
                           gdouble scale);

Sets the scale of the n -th free parameter to scale .

Parameters

mset

a NcmMSet

 

n

free parameter index

 

scale

new scale

 

ncm_mset_fparam_valid_bounds ()

gboolean
ncm_mset_fparam_valid_bounds (NcmMSet *mset,
                              NcmVector *theta);

Checks if the values of theta respect the parameter bounds.

Parameters

mset

a NcmMSet

 

theta

free parameters vector

 

Returns

whether theta contain values respecting the parameter bounds.


ncm_mset_fparam_valid_bounds_offset ()

gboolean
ncm_mset_fparam_valid_bounds_offset (NcmMSet *mset,
                                     NcmVector *theta,
                                     guint offset);

Checks if the values of theta respect the parameter bounds. The values are checked starting at offset .

Parameters

mset

a NcmMSet

 

theta

free parameters vector

 

offset

starting index

 

Returns

whether theta contain values respecting the parameter bounds.


ncm_mset_fparam_validate_all ()

gboolean
ncm_mset_fparam_validate_all (NcmMSet *mset,
                              NcmVector *theta);

Checks if the values of theta respect all requirements.

Parameters

mset

a NcmMSet

 

theta

free parameters vector

 

Returns

whether theta contain values respecting all requirements.


ncm_mset_fparam_get ()

gdouble
ncm_mset_fparam_get (NcmMSet *mset,
                     guint n);

Gets the value of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the value of the n -th free parameter.


ncm_mset_fparam_set ()

void
ncm_mset_fparam_set (NcmMSet *mset,
                     guint n,
                     const gdouble x);

Sets the value of the n -th free parameter to x .

Parameters

mset

a NcmMSet

 

n

free parameter index

 

x

new value

 

ncm_mset_fparam_get_pi ()

const NcmMSetPIndex *
ncm_mset_fparam_get_pi (NcmMSet *mset,
                        guint n);

Gets the NcmMSetPIndex of the n -th free parameter.

Parameters

mset

a NcmMSet

 

n

free parameter index

 

Returns

the NcmMSetPIndex of the n -th free parameter.

[transfer none]


ncm_mset_fparam_get_fpi ()

gint
ncm_mset_fparam_get_fpi (NcmMSet *mset,
                         NcmModelID mid,
                         guint pid);

Gets the free parameter index of the parameter pid in the model mid .

Parameters

mset

a NcmMSet

 

mid

a NcmModelID

 

pid

parameter id

 

Returns

the free parameter index of the parameter pid in the model mid .


ncm_mset_fparam_get_pi_by_name ()

const NcmMSetPIndex *
ncm_mset_fparam_get_pi_by_name (NcmMSet *mset,
                                const gchar *name);

Gets the NcmMSetPIndex of the parameter identified by name . The name can be the parameter name or the full name.

Parameters

mset

a NcmMSet

 

name

parameter name

 

Returns

the NcmMSetPIndex of the parameter identified by name .

[transfer none]


ncm_mset_save ()

void
ncm_mset_save (NcmMSet *mset,
               NcmSerialize *ser,
               const gchar *filename,
               gboolean save_comment);

Saves the NcmMSet to a file using GKeyFile.

Parameters

mset

a NcmMSet

 

ser

a NcmSerialize

 

filename

a filename

 

save_comment

whether to save comments

 

ncm_mset_load ()

NcmMSet *
ncm_mset_load (const gchar *filename,
               NcmSerialize *ser);

Loads a NcmMSet from a configuration file using the NcmSerialize object ser . The file must be in the same format as the one generated by ncm_mset_save().

[constructor]

Parameters

filename

mset filename

 

ser

a NcmSerialize

 

Returns

the loaded NcmMSet.

[transfer full]

Types and Values

NCM_TYPE_MSET

#define NCM_TYPE_MSET (ncm_mset_get_type ())

NCM_MSET_MAX_STACKSIZE

#define NCM_MSET_MAX_STACKSIZE 1000

NCM_MSET_INIT_MARRAY

#define NCM_MSET_INIT_MARRAY 32

struct NcmMSetModelDesc

struct NcmMSetModelDesc {
};

struct NcmMSetClass

struct NcmMSetClass {
};

NCM_MSET_MODEL_MAIN

#define NCM_MSET_MODEL_MAIN (-1)

Id of a main model. Used to identify the main model in hierarchy of models.


NcmMSet

typedef struct _NcmMSet NcmMSet;

Property Details

The “fmap” property

  “fmap”                     GStrv

Free params map.

Owner: NcmMSet

Flags: Read / Write


The “model-array” property

  “model-array”              NcmObjArray *

NcmModel array.

Owner: NcmMSet

Flags: Read / Write / Construct


The “valid-map” property

  “valid-map”                gboolean

Valid properties map.

Owner: NcmMSet

Flags: Read / Write

Default value: FALSE