| NumCosmo Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#define NCM_N2VECTOR (v) #define NCM_VECTOR_DATA (cv) struct NcmVector; struct NcmVectorClass; enum NcmVectorInternal; void ncm_vector_add (NcmVector *cv1,const NcmVector *cv2); void ncm_vector_addto (NcmVector *cv,const guint i,const gdouble val); void ncm_vector_const_free (const NcmVector *cv); const gsl_vector * ncm_vector_const_gsl (const NcmVector *cv); NcmVector * ncm_vector_copy (const NcmVector *cv); void ncm_vector_div (NcmVector *cv1,const NcmVector *cv2); void ncm_vector_free (NcmVector *cv); gdouble ncm_vector_get (const NcmVector *cv,const guint i); GArray * ncm_vector_get_array (NcmVector *cv); NcmVector * ncm_vector_get_subvector (NcmVector *cv,const gsize k,const gsize size); gsl_vector * ncm_vector_gsl (NcmVector *cv); guint ncm_vector_len (const NcmVector *cv); void ncm_vector_memcpy (NcmVector *cv1,const NcmVector *cv2); void ncm_vector_memcpy2 (NcmVector *cv1,const NcmVector *cv2,const guint cv1_start,const guint cv2_start,const guint size); NcmVector * ncm_vector_new (gsize n); NcmVector * ncm_vector_new_array (GArray *a); const NcmVector * ncm_vector_new_data_const (const gdouble *d,const gsize size,const gsize stride); NcmVector * ncm_vector_new_data_malloc (gdouble *d,const gsize size,const gsize stride); NcmVector * ncm_vector_new_data_slice (gdouble *d,const gsize size,const gsize stride); NcmVector * ncm_vector_new_data_static (gdouble *d,const gsize size,const gsize stride); NcmVector * ncm_vector_new_gsl (gsl_vector *gv); const NcmVector * ncm_vector_new_gsl_const (const gsl_vector *v); N_Vector ncm_vector_nvector (NcmVector *cv); gdouble * ncm_vector_ptr (NcmVector *cv,const guint i); NcmVector * ncm_vector_ref (NcmVector *cv); void ncm_vector_scale (NcmVector *cv,const gdouble val); void ncm_vector_set (NcmVector *cv,const guint i,const gdouble val); void ncm_vector_set_all (NcmVector *cv,const gdouble val); void ncm_vector_set_zero (NcmVector *cv); guint ncm_vector_stride (const NcmVector *cv); void ncm_vector_sub (NcmVector *cv1,const NcmVector *cv2); void ncm_vector_subfrom (NcmVector *cv,const guint i,const gdouble val);
typedef enum {
NCM_VECTOR_SLICE = 0,
NCM_VECTOR_GSL_VECTOR,
NCM_VECTOR_MALLOC,
NCM_VECTOR_ARRAY,
NCM_VECTOR_DERIVED,
} NcmVectorInternal;
FIXME
void ncm_vector_add (NcmVector *cv1,const NcmVector *cv2);
This function adds the components of the vector cv2 to the components of the vector cv1.
The two vectors must have the same length.
void ncm_vector_addto (NcmVector *cv,const guint i,const gdouble val);
This function adds val to the value of the i-th component of cv.
|
a NcmVector. |
|
component index. |
|
a constant double. |
void ncm_vector_const_free (const NcmVector *cv);
Atomically decrements the reference count of cv by one. If the reference count drops to 0,
all memory allocated by cv is released.
|
a constant NcmVector. |
const gsl_vector * ncm_vector_const_gsl (const NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME |
NcmVector * ncm_vector_copy (const NcmVector *cv);
This function copies the elements of the constant vector cv into a new NcmVector.
void ncm_vector_div (NcmVector *cv1,const NcmVector *cv2);
This function divides the components of the vector cv1 by the components of the vector cv2.
The two vectors must have the same length.
void ncm_vector_free (NcmVector *cv);
Atomically decrements the reference count of cv by one. If the reference count drops to 0,
all memory allocated by cv is released.
|
a NcmVector. |
gdouble ncm_vector_get (const NcmVector *cv,const guint i);
|
a constant NcmVector. |
|
component index. |
Returns : |
The i-th component of the vector cv. |
GArray * ncm_vector_get_array (NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME. [transfer container][element-type double] |
NcmVector * ncm_vector_get_subvector (NcmVector *cv,const gsize k,const gsize size);
This function returns a NcmVector which is a subvector of the vector cv.
The start of the new vector is the k-th component from the original vector cv.
The new vector has size elements.
gsl_vector * ncm_vector_gsl (NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME |
guint ncm_vector_len (const NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME |
void ncm_vector_memcpy (NcmVector *cv1,const NcmVector *cv2);
This function copies the components of the vector cv1 into the vector cv2.
The two vectors must have the same length.
void ncm_vector_memcpy2 (NcmVector *cv1,const NcmVector *cv2,const guint cv1_start,const guint cv2_start,const guint size);
This function copies size components of cv2, counting from cv2_start,
to the vector cv1, starting from the cv1_start component.
It is useful for vectors with different sizes.
NcmVector * ncm_vector_new (gsize n);
This function allocates memory for a new NcmVector of double
with n components.
|
defines the size of the vector. |
Returns : |
A new NcmVector. |
NcmVector * ncm_vector_new_array (GArray *a);
This function saves a internally and frees it when it is no longer necessary.
The a array must not be freed.
const NcmVector * ncm_vector_new_data_const (const gdouble *d,const gsize size,const gsize stride);
This function returns a constant NcmVector of the array d.
The memory allocated is kept during all time life of the object and
must not be freed during this period.
|
pointer to the first double allocated. |
|
number of doubles allocated. |
|
the step-size from one element to the next in physical memory, measured in units of double. |
Returns : |
A new constant NcmVector. |
NcmVector * ncm_vector_new_data_malloc (gdouble *d,const gsize size,const gsize stride);
This function returns a NcmVector of the array d allocated using malloc.
It saves d internally and frees it when it is no longer necessary.
|
pointer to the first double allocated. |
|
number of doubles allocated. |
|
the step-size from one element to the next in physical memory, measured in units of double. |
Returns : |
A new NcmVector. |
NcmVector * ncm_vector_new_data_slice (gdouble *d,const gsize size,const gsize stride);
This function returns a NcmVector of the array d allocated using g_slice function.
This function saves a internally and frees it when it is no longer necessary.
The a vector must not be freed.
|
pointer to the first double allocated. |
|
number of doubles allocated. |
|
the step-size from one element to the next in physical memory, measured in units of double. |
Returns : |
A new NcmVector. |
NcmVector * ncm_vector_new_data_static (gdouble *d,const gsize size,const gsize stride);
This function returns a NcmVector of the array d.
The memory allocated is kept during all time life of the object and
must not be freed during this period.
|
pointer to the first double allocated. |
|
number of doubles allocated. |
|
the step-size from one element to the next in physical memory, measured in units of double. |
Returns : |
A new NcmVector. |
NcmVector * ncm_vector_new_gsl (gsl_vector *gv);
This function saves gv internally and frees it when it is no longer necessary.
The gv vector must not be freed.
const NcmVector * ncm_vector_new_gsl_const (const gsl_vector *v);
This function converts v into a constant NcmVector.
|
vector from GNU Scientific Library (GSL). |
Returns : |
A new constant NcmVector. |
N_Vector ncm_vector_nvector (NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME |
gdouble * ncm_vector_ptr (NcmVector *cv,const guint i);
|
a NcmVector. |
|
component index. |
Returns : |
A pointer to the i-th component of the vector cv. |
NcmVector * ncm_vector_ref (NcmVector *cv);
This function increses the reference count of cv or sink
the object.
|
a NcmVector. |
Returns : |
cv. [transfer full]
|
void ncm_vector_scale (NcmVector *cv,const gdouble val);
This function multiplies the components of the vector cv by the constant factor val.
|
a NcmVector. |
|
a cosntant double. |
void ncm_vector_set (NcmVector *cv,const guint i,const gdouble val);
This function sets the value of the i-th component of the vector cv to val.
|
a NcmVector. |
|
component index. |
|
a constant double. |
void ncm_vector_set_all (NcmVector *cv,const gdouble val);
This function sets all the components of the vector cv to the value val.
|
a NcmVector. |
|
a cosntant double. |
void ncm_vector_set_zero (NcmVector *cv);
This function sets all the components of the vector cv to zero.
|
a NcmVector. |
guint ncm_vector_stride (const NcmVector *cv);
FIXME
|
a NcmVector. |
Returns : |
FIXME |
void ncm_vector_sub (NcmVector *cv1,const NcmVector *cv2);
This function subtracts the components of the vector cv2 to the components of the vector cv1.
The two vectors must have the same length.