Top |
NcmISet * | ncm_iset_new () |
NcmISet * | ncm_iset_ref () |
void | ncm_iset_free () |
void | ncm_iset_clear () |
void | ncm_iset_add_range () |
void | ncm_iset_add () |
void | ncm_iset_del () |
void | ncm_iset_reset () |
void | ncm_iset_copy () |
guint | ncm_iset_get_max_size () |
guint | ncm_iset_get_len () |
gdouble | ncm_iset_get_vector_max () |
NcmVector * | ncm_iset_get_subvector () |
GArray * | ncm_iset_get_subarray () |
NcmMatrix * | ncm_iset_get_submatrix () |
NcmMatrix * | ncm_iset_get_submatrix_cols () |
NcmMatrix * | ncm_iset_get_submatrix_colmajor_cols () |
NcmMatrix * | ncm_iset_get_sym_submatrix () |
void | ncm_iset_get_subset_vec_lt () |
void | ncm_iset_remove_subset () |
guint | ncm_iset_remove_smallest_subset () |
guint | ncm_iset_add_largest_subset () |
void | ncm_iset_set_complement () |
NcmVector * | ncm_iset_get_vector_inv_cmp () |
void | ncm_iset_set_subvector () |
void | ncm_iset_log_vals () |
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.
void
ncm_iset_clear (NcmISet **iset
);
Decrease the reference count of iset
by one, and sets the pointer *iset
to
NULL.
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.
gdouble ncm_iset_get_vector_max (NcmISet *iset
,NcmVector *v
,gint *max_i
);
Finds the maximum component of the vector v
.
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.
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]
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.
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.
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.
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.
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$.
void ncm_iset_remove_subset (NcmISet *iset
,NcmISet *target
);
Removes indexes of iset
from target
.
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.
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
.
void ncm_iset_set_complement (NcmISet *iset
,NcmISet *cmplm
);
Sets cmplm
as the complement of iset
.
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
.
void ncm_iset_set_subvector (NcmISet *iset
,NcmVector *v
,NcmVector *sub
);
Copies the components from sub
to the indexes iset
in v
.