NcmData

NcmData — Abstract class for implementing data objects.

Properties

NcmBootstrap * bootstrap Read / Write
gchar * desc Read / Write
gboolean init Read / Write
gchar * long-desc Read / Write
gchar * name Read

Types and Values

Object Hierarchy

    GObject
    ╰── NcmData
        ├── NcmDataGaussDiag
        ├── NcmDataGaussCov
        ├── NcmDataDist1d
        ├── NcmDataGauss
        ├── NcDataClusterNCount
        ├── NcmDataPoisson
        ├── NcDataClusterPseudoCounts
        ╰── NcDataPlanckLKL

Description

The NcmData object represent generic data. This is the root object used when building a statistical analysis. Every implementation of NcmData envolves the methods described in NcmDataClass.

A NcmData must implement, at least, the method NcmDataClass.m2lnL_val or NcmDataClass.leastsquares_f to perform respectively likelihood or least squares analysis.

Functions

ncm_data_ref ()

NcmData *
ncm_data_ref (NcmData *data);

Increase the reference count of data .

Parameters

data

a NcmData.

 

Returns

data .

[transfer full]


ncm_data_free ()

void
ncm_data_free (NcmData *data);

Decrease the reference count of data .

Parameters

data

a NcmData.

 

ncm_data_clear ()

void
ncm_data_clear (NcmData **data);

Decrease the reference count of *data and sets the pointer *data to NULL.

Parameters

data

a NcmData.

 

ncm_data_dup ()

NcmData *
ncm_data_dup (NcmData *data,
              NcmSerialize *ser_obj);

Duplicate the data object.

Parameters

data

a NcmData.

 

ser_obj

a NcmSerialize.

 

Returns

a duplicate of data .

[transfer full]


ncm_data_new_from_file ()

NcmData *
ncm_data_new_from_file (const gchar *filename);

Creates a new NcmData from filename .

Parameters

filename

file containing a serialized NcmData child.

 

Returns

the newly created NcmData.

[transfer full]


ncm_data_get_length ()

guint
ncm_data_get_length (NcmData *data);

Return a integer representing the number of data points.

[virtual get_length]

Parameters

data

a NcmData.

 

Returns

number of data points.


ncm_data_get_dof ()

guint
ncm_data_get_dof (NcmData *data);

Calculates the degrees of freedom associated with the data.

[virtual get_dof]

Parameters

data

a NcmData.

 

Returns

degrees of freedom of the data.


ncm_data_set_init ()

void
ncm_data_set_init (NcmData *data,
                   gboolean state);

Sets the data to initialized or not state .

Parameters

data

a NcmData

 

state

a boolean

 

ncm_data_set_desc ()

void
ncm_data_set_desc (NcmData *data,
                   const gchar *desc);

Sets the data description. It gets a copy of desc.

Parameters

data

a NcmData.

 

desc

description.

 

ncm_data_take_desc ()

void
ncm_data_take_desc (NcmData *data,
                    gchar *desc);

Sets the data description desc without copying it, the desc memory will be freed (g_free()) when the object is freed.

Parameters

data

a NcmData.

 

desc

description.

 

ncm_data_peek_desc ()

const gchar *
ncm_data_peek_desc (NcmData *data);

Gets data description.

Parameters

data

a NcmData.

 

Returns

internal data description.

[transfer none]


ncm_data_get_desc ()

gchar *
ncm_data_get_desc (NcmData *data);

Gets data description.

Parameters

data

a NcmData.

 

Returns

copy of the data description.

[transfer full]


ncm_data_prepare ()

void
ncm_data_prepare (NcmData *data,
                  NcmMSet *mset);

Prepare all models in data necessary for the statistical calculations.

[virtual prepare]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

ncm_data_resample ()

void
ncm_data_resample (NcmData *data,
                   NcmMSet *mset,
                   NcmRNG *rng);

Resample data in data from the models contained in mset .

[virtual resample]

Parameters

data

a NcmData

 

mset

a NcmMSet

 

rng

a NcmRNG

 

ncm_data_bootstrap_create ()

void
ncm_data_bootstrap_create (NcmData *data);

Creates a bootstrap object inside of data . Uses the default bsize == fsize.

Parameters

data

a NcmData.

 

ncm_data_bootstrap_remove ()

void
ncm_data_bootstrap_remove (NcmData *data);

Removes a bootstrap object inside of data if any.

Parameters

data

a NcmData.

 

ncm_data_bootstrap_set ()

void
ncm_data_bootstrap_set (NcmData *data,
                        NcmBootstrap *bstrap);

Sets the bstrap object in data checking if they are compatible.

Parameters

data

a NcmData.

 

bstrap

a NcmBootstrap.

 

ncm_data_bootstrap_resample ()

void
ncm_data_bootstrap_resample (NcmData *data,
                             NcmRNG *rng);

Perform one bootstrap, i.e., resample the data with replacement.

Parameters

data

a NcmData.

 

rng

a NcmRNG.

 

ncm_data_bootstrap_enabled ()

gboolean
ncm_data_bootstrap_enabled (NcmData *data);

Checks whether bootstrap is enabled in data .

Parameters

data

a NcmData.

 

Returns

if bootstrap is enabled in data .


ncm_data_leastsquares_f ()

void
ncm_data_leastsquares_f (NcmData *data,
                         NcmMSet *mset,
                         NcmVector *f);

Calculates the least squares vector $\vec{f}$ using the models contained in mset and set the results in f .

[virtual leastsquares_f]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

f

a NcmVector

 

ncm_data_leastsquares_J ()

void
ncm_data_leastsquares_J (NcmData *data,
                         NcmMSet *mset,
                         NcmMatrix *J);

Calculates the least squares jacobian matrix $$J_{ij} = \frac{df_i}{dx_j},$$ where $f_i$ is the component of the least squares vector $\vec{f}$ and $x_j$ is the j-th parameter.

[virtual leastsquares_J]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

J

a NcmMatrix.

 

ncm_data_leastsquares_f_J ()

void
ncm_data_leastsquares_f_J (NcmData *data,
                           NcmMSet *mset,
                           NcmVector *f,
                           NcmMatrix *J);

Calculates both least squares vector and matrix as in ncm_data_leastsquares_f() and ncm_data_leastsquares_J().

[virtual leastsquares_f_J]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

f

a NcmVector.

 

J

a NcmMatrix

 

ncm_data_m2lnL_val ()

void
ncm_data_m2lnL_val (NcmData *data,
                    NcmMSet *mset,
                    gdouble *m2lnL);

Calculates the value of $-2\ln(L)$, where $L$ represents the likelihood of the data given the models in mset . The result is stored in m2lnL .

[virtual m2lnL_val]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

m2lnL

a double.

[out]

ncm_data_m2lnL_grad ()

void
ncm_data_m2lnL_grad (NcmData *data,
                     NcmMSet *mset,
                     NcmVector *grad);

Calculates the gradient of $-2\ln(L)$, i.e., $$g_i = -2\frac{d\ln(L)}{dx_i}.$$ where $L$ represents the likelihood of the data given the models in mset . The result is stored in grad .

[virtual m2lnL_grad]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

grad

a NcmVector.

 

ncm_data_m2lnL_val_grad ()

void
ncm_data_m2lnL_val_grad (NcmData *data,
                         NcmMSet *mset,
                         gdouble *m2lnL,
                         NcmVector *grad);

Calculates both the value and the gradient of $-2\ln(L)$ as in ncm_data_m2lnL_val() and ncm_data_m2lnL_grad().

[virtual m2lnL_val_grad]

Parameters

data

a NcmData.

 

mset

a NcmMSet.

 

m2lnL

a double.

[out]

grad

a NcmVector.

 

Types and Values

struct NcmDataClass

struct NcmDataClass {
  gboolean bootstrap;
  guint (*get_length) (NcmData *data);
  guint (*get_dof) (NcmData *data);
  void (*begin) (NcmData *data);
  void (*prepare) (NcmData *data, NcmMSet *mset);
  void (*resample) (NcmData *data, NcmMSet *mset, NcmRNG *rng);
  void (*leastsquares_f) (NcmData *data, NcmMSet *mset, NcmVector *f);
  void (*leastsquares_J) (NcmData *data, NcmMSet *mset, NcmMatrix *J);
  void (*leastsquares_f_J) (NcmData *data, NcmMSet *mset, NcmVector *f, NcmMatrix *J);
  void (*m2lnL_val) (NcmData *data, NcmMSet *mset, gdouble *m2lnL);
  void (*m2lnL_grad) (NcmData *data, NcmMSet *mset, NcmVector *grad);
  void (*m2lnL_val_grad) (NcmData *data, NcmMSet *mset, gdouble *m2lnL, NcmVector *grad);
};

Virtual table for the NcmData abstract class.

Members

gboolean bootstrap;

sets whenever the NcmData implementations supports bootstrap.

 

get_length ()

return the length associated to the NcmData object.

 

get_dof ()

return the effective degrees of freedom related to the NcmData statistics (likelihood or $\chi^2$) this number does not represent necessarely the number of data points.

 

begin ()

perform any model independent precalculation.

 

prepare ()

perform any model dependent precalculation.

 

resample ()

resample data from the models in NcmMSet.

 

leastsquares_f ()

calculates the least squares $\vec{f}$ vector, i.e., $\chi^2 \equiv \vec{f}\cdot\vec{f}$.

 

leastsquares_J ()

calculates the least squares $\vec{f}$ vector derivatives with respect to the free parameter of mset .

 

leastsquares_f_J ()

calculates both least squares vector and its derivatives.

 

m2lnL_val ()

evaluate the minus two times the natural logarithim of the likelihood, i.e., $-2\ln(L)$.

 

m2lnL_grad ()

evaluate the gradient of $-2\ln(L)$ with respect to the free parameters in mset .

 

m2lnL_val_grad ()

evaluate the value and the gradient of $-2\ln(L)$.

 

NCM_DATA_RESAMPLE_RNG_NAME

#define NCM_DATA_RESAMPLE_RNG_NAME "data_resample"

Property Details

The “bootstrap” property

  “bootstrap”                NcmBootstrap *

The NcmData bootstrap object if any.

Flags: Read / Write


The “desc” property

  “desc”                     gchar *

Description of the data object.

Flags: Read / Write

Default value: NULL


The “init” property

  “init”                     gboolean

Data initialized state.

Flags: Read / Write

Default value: FALSE


The “long-desc” property

  “long-desc”                gchar *

Description of the data object.

Flags: Read / Write

Default value: NULL


The “name” property

  “name”                     gchar *

Name of the data object.

Flags: Read

Default value: NULL