NcmMSetFunc

NcmMSetFunc — Abstract class for arbitrary MSet functions.

Functions

Properties

guint dimension Read / Write / Construct Only
NcmVector * eval-x Read / Write
guint nvariables Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── NcmMSetFunc
        ├── NcmPrior
        ├── NcmMSetFunc1
        ╰── NcmMSetFuncList

Description

This abstract class provides a framework for functions that operate on any model in a NcmMSet and additional extra variables. It establishes methods to inquire about the function's expectations and characteristics.

The functions implemented by subclasses may depend on any model specified by NcmMSet and may incorporate extra variables. The method ncm_mset_func_get_nvar() retrieves the count of extra variables expected by the function, and ncm_mset_func_get_dim() returns the number of values returned by the function.

Functions can be categorized as scalar or vectorial. A scalar function returns a single value, while a vectorial function returns an array of values. The method ncm_mset_func_is_scalar() returns TRUE if the function is scalar.

Functions

NcmMSetFuncN ()

void
(*NcmMSetFuncN) (NcmMSetFunc *func,
                 NcmMSet *mset,
                 const gdouble *x,
                 gdouble *res);

ncm_mset_func_ref ()

NcmMSetFunc *
ncm_mset_func_ref (NcmMSetFunc *func);

Increases the reference count of func by one.

Parameters

func

a NcmMSetFunc.

 

Returns

func .

[transfer full]


ncm_mset_func_free ()

void
ncm_mset_func_free (NcmMSetFunc *func);

Decreases the reference count of func by one. If the reference count reaches zero, func is freed.

Parameters

func

a NcmMSetFunc.

 

ncm_mset_func_clear ()

void
ncm_mset_func_clear (NcmMSetFunc **func);

If *func is not NULL, decreases the reference count of func by one and sets *func to NULL.

Parameters

func

a NcmMSetFunc.

 

ncm_mset_func_array_new ()

GPtrArray *
ncm_mset_func_array_new (void);

Creates a new GPtrArray to hold NcmMSetFunc pointers.

Returns

the new GPtrArray.

[element-type NcmMSetFunc][transfer full]


ncm_mset_func_eval ()

void
ncm_mset_func_eval (NcmMSetFunc *func,
                    NcmMSet *mset,
                    gdouble *x,
                    gdouble *res);

Evaluate the function func at x and store the result in res .

[virtual eval]

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

x

function arguments.

[array][element-type double]

res

function values.

[array][element-type double]

ncm_mset_func_eval_nvar ()

gdouble
ncm_mset_func_eval_nvar (NcmMSetFunc *func,
                         NcmMSet *mset,
                         const gdouble *x);

Evaluate the function func at x and return the result. This function is only valid if func is a scalar function.

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

x

function arguments

 

Returns

function value.


ncm_mset_func_eval0 ()

gdouble
ncm_mset_func_eval0 (NcmMSetFunc *func,
                     NcmMSet *mset);

Evaluate the function func and return the result. This function is only valid if func is a scalar function. The function's arguments are either none, if the function is constant, or the arguments passed to ncm_mset_func_set_eval_x().

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

Returns

function value.


ncm_mset_func_eval1 ()

gdouble
ncm_mset_func_eval1 (NcmMSetFunc *func,
                     NcmMSet *mset,
                     const gdouble x);

Evaluate the function func at x and return the result. This function is only valid if func is a scalar function.

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

x

function argument

 

Returns

function value.


ncm_mset_func_eval_vector ()

void
ncm_mset_func_eval_vector (NcmMSetFunc *func,
                           NcmMSet *mset,
                           NcmVector *x_v,
                           NcmVector *res_v);

Compute the function func at x_v and store the result in res_v . This function is only valid if func is a vectorial function.

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

x_v

function arguments in a NcmVector

 

res_v

a NcmVector to store the function values

 

ncm_mset_func_set_eval_x ()

void
ncm_mset_func_set_eval_x (NcmMSetFunc *func,
                          gdouble *x,
                          guint len);

Sets the function's arguments to x . Once this function is called, the function's arguments are fixed and func becomes a constant function.

Parameters

func

a NcmMSetFunc

 

x

function arguments.

[in][array length=len]

len

length of x

 

ncm_mset_func_is_scalar ()

gboolean
ncm_mset_func_is_scalar (NcmMSetFunc *func);

Checks if func is a scalar function.

Parameters

func

a NcmMSetFunc

 

Returns

TRUE if func is scalar.


ncm_mset_func_is_vector ()

gboolean
ncm_mset_func_is_vector (NcmMSetFunc *func,
                         guint dim);

Checks if func is a vectorial function with dimension dim .

Parameters

func

a NcmMSetFunc

 

dim

function dimension

 

Returns

TRUE if func is vectorial with dimension dim .


ncm_mset_func_is_const ()

gboolean
ncm_mset_func_is_const (NcmMSetFunc *func);

Checks if func is a constant function.

Parameters

func

a NcmMSetFunc

 

Returns

TRUE if func is constant.


ncm_mset_func_has_nvar ()

gboolean
ncm_mset_func_has_nvar (NcmMSetFunc *func,
                        guint nvar);

Checks if func expects nvar extra variables.

Parameters

func

a NcmMSetFunc

 

nvar

number of variables

 

Returns

TRUE if func expects nvar extra variables.


ncm_mset_func_get_nvar ()

guint
ncm_mset_func_get_nvar (NcmMSetFunc *func);

Gets the number of variables of func .

Parameters

func

a NcmMSetFunc

 

Returns

number of variables expected by func .


ncm_mset_func_get_dim ()

guint
ncm_mset_func_get_dim (NcmMSetFunc *func);

Gets the dimension of func .

Parameters

func

a NcmMSetFunc

 

Returns

number values returned by func .


ncm_mset_func_set_meta ()

void
ncm_mset_func_set_meta (NcmMSetFunc *func,
                        const gchar *name,
                        const gchar *symbol,
                        const gchar *ns,
                        const gchar *desc,
                        const guint nvar,
                        const guint dim);

Sets the function's metadata. This function is called by subclasses' to set the function's metadata. It should not be called by users.

Parameters

func

a NcmMSetFunc

 

name

function name

 

symbol

function symbol

 

ns

function namespace

 

desc

function description

 

nvar

number of variables

 

dim

function dimension

 

ncm_mset_func_peek_name ()

const gchar *
ncm_mset_func_peek_name (NcmMSetFunc *func);

Parameters

func

a NcmMSetFunc

 

Returns

func name.

[transfer none]


ncm_mset_func_peek_symbol ()

const gchar *
ncm_mset_func_peek_symbol (NcmMSetFunc *func);

Parameters

func

a NcmMSetFunc

 

Returns

func symbol.

[transfer none]


ncm_mset_func_peek_ns ()

const gchar *
ncm_mset_func_peek_ns (NcmMSetFunc *func);

Parameters

func

a NcmMSetFunc

 

Returns

func ns.

[transfer none]


ncm_mset_func_peek_desc ()

const gchar *
ncm_mset_func_peek_desc (NcmMSetFunc *func);

Parameters

func

a NcmMSetFunc

 

Returns

func desc.

[transfer none]


ncm_mset_func_peek_uname ()

const gchar *
ncm_mset_func_peek_uname (NcmMSetFunc *func);

Peeks unique name.

Parameters

func

a NcmMSetFunc

 

Returns

func unique name.

[transfer none]


ncm_mset_func_peek_usymbol ()

const gchar *
ncm_mset_func_peek_usymbol (NcmMSetFunc *func);

Peeks unique symbol.

Parameters

func

a NcmMSetFunc

 

Returns

func unique name.

[transfer none]


ncm_mset_func_numdiff_fparams ()

void
ncm_mset_func_numdiff_fparams (NcmMSetFunc *func,
                               NcmMSet *mset,
                               const gdouble *x,
                               NcmVector **out);

Computes the gradient of func at x and stores the result in out . This function is only valid if func is a scalar function.

Parameters

func

a NcmMSetFunc

 

mset

a NcmMSet

 

x

function arguments.

[array]

out

function gradient.

[out][transfer full]

Types and Values

NCM_TYPE_MSET_FUNC

#define NCM_TYPE_MSET_FUNC (ncm_mset_func_get_type ())

struct NcmMSetFuncClass

struct NcmMSetFuncClass {
};

NcmMSetFunc

typedef struct _NcmMSetFunc NcmMSetFunc;

Property Details

The “dimension” property

  “dimension”                guint

Function dimension.

Owner: NcmMSetFunc

Flags: Read / Write / Construct Only

Default value: 0


The “eval-x” property

  “eval-x”                   NcmVector *

Evaluation point x.

Owner: NcmMSetFunc

Flags: Read / Write


The “nvariables” property

  “nvariables”               guint

Number of variables.

Owner: NcmMSetFunc

Flags: Read / Write / Construct Only

Default value: 0