NcmISet

NcmISet — Index set object

Functions

Properties

guint max-index Read / Write / Construct Only

Types and Values

#define NCM_TYPE_ISET
  NcmISet

Object Hierarchy

    GObject
    ╰── NcmISet

Description

NcmISet is an object that stores a set of indexes. It is used to store the indexes of the components of a vector or matrix that are being used in a calculation.

Functions

ncm_iset_new ()

NcmISet *
ncm_iset_new (guint n);

Creates a new NcmISet object.

Parameters

n

maximum index

 

Returns

a new NcmISet.


ncm_iset_ref ()

NcmISet *
ncm_iset_ref (NcmISet *iset);

Increase the reference of iset by one.

Parameters

iset

a NcmISet

 

Returns

iset .

[transfer full]


ncm_iset_free ()

void
ncm_iset_free (NcmISet *iset);

Decrease the reference count of iset by one.

Parameters

iset

a NcmISet

 

ncm_iset_clear ()

void
ncm_iset_clear (NcmISet **iset);

Decrease the reference count of iset by one, and sets the pointer *iset to NULL.

Parameters

iset

a NcmISet

 

ncm_iset_add_range ()

void
ncm_iset_add_range (NcmISet *iset,
                    gint ii,
                    gint fi);

Adds the interval $(i_i, i_f]$ to the set. Note that $i_f$ is not included.

Parameters

iset

a NcmISet

 

ii

initial index $i_i$

 

fi

final index $i_f$

 

ncm_iset_add ()

void
ncm_iset_add (NcmISet *iset,
              gint i);

Adds the index $i$ to the set.

Parameters

iset

a NcmISet

 

i

index $i$

 

ncm_iset_del ()

void
ncm_iset_del (NcmISet *iset,
              gint i);

Removes the index $i$ from the set.

Parameters

iset

a NcmISet

 

i

index $i$

 

ncm_iset_reset ()

void
ncm_iset_reset (NcmISet *iset);

Removes all indexes from the set.

Parameters

iset

a NcmISet

 

ncm_iset_copy ()

void
ncm_iset_copy (NcmISet *iset,
               NcmISet *target);

ncm_iset_get_max_size ()

guint
ncm_iset_get_max_size (NcmISet *iset);

ncm_iset_get_len ()

guint
ncm_iset_get_len (NcmISet *iset);

Parameters

iset

a NcmISet

 

Returns

number of elements in iset .


ncm_iset_get_vector_max ()

gdouble
ncm_iset_get_vector_max (NcmISet *iset,
                         NcmVector *v,
                         gint *max_i);

Finds the maximum component of the vector v .

Parameters

iset

a NcmISet

 

v

a NcmVector

 

max_i

Maximum component index.

[out]

ncm_iset_get_subvector ()

NcmVector *
ncm_iset_get_subvector (NcmISet *iset,
                        NcmVector *v,
                        NcmVector *v_dup);

Construct a continuous vector $s$ using the values from v and the indexes in iset . If v_dup is not null use this vector to build the subvector, otherwise, allocates a new vector.

Parameters

iset

a NcmISet

 

v

a NcmVector

 

v_dup

a NcmVector

 

Returns

the vector $s$.

[transfer full]


ncm_iset_get_subarray ()

GArray *
ncm_iset_get_subarray (NcmISet *iset,
                       GArray *a,
                       GArray *a_dup);

Construct a continuous array using the values from a and the indexes in iset . If a_dup is not null use this array to build the subarray, otherwise, allocates a new array.

[skip]

Parameters

iset

a NcmISet

 

a

a GArray

 

a_dup

a GArray

 

Returns

the subarray.

[transfer full]


ncm_iset_get_submatrix ()

NcmMatrix *
ncm_iset_get_submatrix (NcmISet *iset,
                        NcmMatrix *M,
                        NcmMatrix *M_dup);

Construct a continuous matrix square $S$ using the values from the square matrix M and the indexes in iset . If M_dup is not null use this matrix to build the submatrix, otherwise, allocates a new matrix.

Parameters

iset

a NcmISet

 

M

a NcmMatrix

 

M_dup

a NcmMatrix

 

Returns

the matrix $S$.

[transfer full]


ncm_iset_get_submatrix_cols ()

NcmMatrix *
ncm_iset_get_submatrix_cols (NcmISet *iset,
                             NcmMatrix *M,
                             NcmMatrix *M_dup);

Construct a continuous matrix rectangular $S$ using the columns from the rectangular matrix M and the indexes in iset . If M_dup is not null use this matrix to build the submatrix, otherwise, allocates a new matrix.

Parameters

iset

a NcmISet

 

M

a NcmMatrix

 

M_dup

a NcmMatrix

 

Returns

the matrix $S$.

[transfer full]


ncm_iset_get_submatrix_colmajor_cols ()

NcmMatrix *
ncm_iset_get_submatrix_colmajor_cols (NcmISet *iset,
                                      NcmMatrix *M,
                                      NcmMatrix *M_dup);

Construct a continuous matrix rectangular $S$ using the columns from the rectangular matrix M and the indexes in iset . If M_dup is not null use this matrix to build the submatrix, otherwise, allocates a new matrix. It writes the columns in $S$ using a colmajor memory scheme. This is useful when using the output matrix into Lapack routines.

Parameters

iset

a NcmISet

 

M

a NcmMatrix

 

M_dup

a NcmMatrix

 

Returns

the matrix $S$.

[transfer full]


ncm_iset_get_sym_submatrix ()

NcmMatrix *
ncm_iset_get_sym_submatrix (NcmISet *iset,
                            gchar UL,
                            NcmMatrix *M,
                            NcmMatrix *M_dup);

Construct a continuous symmetric matrix $S$ using the values from M and the indexes in iset . If M_dup is not null use this matrix to build the submatrix, otherwise, allocates a new matrix. If UL == 'U'/'L' only the Upper/Lower triangle will be copied.

Parameters

iset

a NcmISet

 

UL

char indicating 'U'pper or 'L'ower matrix

 

M

a NcmMatrix

 

M_dup

a NcmMatrix

 

Returns

the matrix $S$.

[transfer full]


ncm_iset_get_subset_vec_lt ()

void
ncm_iset_get_subset_vec_lt (NcmISet *iset,
                            NcmISet *out,
                            NcmVector *v,
                            const gdouble tol);

Gets the subset (out ) of iset where $v_i < t$.

Parameters

iset

a NcmISet

 

out

a NcmISet

 

v

a NcmVector

 

tol

a double $t$

 

ncm_iset_remove_subset ()

void
ncm_iset_remove_subset (NcmISet *iset,
                        NcmISet *target);

Removes indexes of iset from target .

Parameters

iset

a NcmISet

 

target

a NcmISet

 

ncm_iset_remove_smallest_subset ()

guint
ncm_iset_remove_smallest_subset (NcmISet *iset,
                                 NcmISet *target,
                                 NcmVector *v,
                                 guint max_remove);

Removes indexes of iset from target based on the values on v . The first max_remove indexes from target matching the smallest components of v are removed.

Parameters

iset

a NcmISet

 

target

a NcmISet

 

v

a NcmVector

 

max_remove

maximum number of indexes to be removed

 

Returns

number of indexes removed


ncm_iset_add_largest_subset ()

guint
ncm_iset_add_largest_subset (NcmISet *iset,
                             NcmVector *v,
                             const gdouble min,
                             const gdouble add_frac);

Adds indexes to iset using the largest values of v satisfying $v_i > \mu$ where $i \in $ complement of iset .

Parameters

iset

a NcmISet

 

v

a NcmVector

 

min

a double $\mu$

 

add_frac

fraction of indexes to be added

 

Returns

number of indexes added.


ncm_iset_set_complement ()

void
ncm_iset_set_complement (NcmISet *iset,
                         NcmISet *cmplm);

Sets cmplm as the complement of iset .

Parameters

iset

a NcmISet

 

cmplm

a NcmISet

 

ncm_iset_get_vector_inv_cmp ()

NcmVector *
ncm_iset_get_vector_inv_cmp (NcmISet *iset,
                             NcmVector *u,
                             NcmVector *v,
                             NcmVector *v_dup);

Computes the inverse of the relative difference between vectors u and v , namely: $$\left(\frac{u_i - v_i}{u_i}\right)^{-1},$$ for indexes $i \in $ iset .

Parameters

iset

a NcmISet

 

u

a NcmVector

 

v

a NcmVector

 

v_dup

a NcmVector

 

Returns

the subset.

[transfer full]


ncm_iset_set_subvector ()

void
ncm_iset_set_subvector (NcmISet *iset,
                        NcmVector *v,
                        NcmVector *sub);

Copies the components from sub to the indexes iset in v .

Parameters

iset

a NcmISet

 

v

a NcmVector

 

sub

a NcmVector

 

ncm_iset_log_vals ()

void
ncm_iset_log_vals (NcmISet *iset,
                   const gchar *prefix);

Logs the indexes on iset with prefix prefix .

Parameters

iset

a NcmISet

 

prefix

a string

 

Types and Values

NCM_TYPE_ISET

#define NCM_TYPE_ISET (ncm_iset_get_type ())

NcmISet

typedef struct _NcmISet NcmISet;

Property Details

The “max-index” property

  “max-index”                guint

Maximum index.

Owner: NcmISet

Flags: Read / Write / Construct Only

Allowed values: >= 1

Default value: 1