Top | ![]() |
![]() |
![]() |
![]() |
Functions
Functions
ncm_topology_comoving_a0_lss ()
gdouble ncm_topology_comoving_a0_lss (guint n
,gdouble alpha
);
FIXME
ncm_topology_sigma_comoving_a0_lss ()
gdouble ncm_topology_sigma_comoving_a0_lss (guint n
,gdouble alpha
,gdouble sigma_alpha
);
FIXME
ncm_util_sqrt1px_m1 ()
gdouble
ncm_util_sqrt1px_m1 (const gdouble x
);
Calculates $\sqrt{1+x}-1$ using the appropriated expression to avoid round-off when $x \approx 0$.
ncm_util_1pcosx ()
gdouble ncm_util_1pcosx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 + \cos(x)$ using the appropriated taylor series when $\cos(x) \approx -1$.
ncm_util_1mcosx ()
gdouble ncm_util_1mcosx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 - \cos(x)$ using the appropriated taylor series when $\cos(x) \approx 1$.
ncm_util_1psinx ()
gdouble ncm_util_1psinx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 + \sin(x)$ using the appropriated taylor series when $\sin(x) \approx -1$.
ncm_util_1msinx ()
gdouble ncm_util_1msinx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 - \sin(x)$ using the appropriated taylor series when $\sin(x) \approx 1$.
ncm_util_cos2x ()
gdouble ncm_util_cos2x (const gdouble sinx
,const gdouble cosx
);
Calculates $\cos(2x)$ using the appropriated taylor series when $\sin(x) \approx 1$.
ncm_cmp ()
gint ncm_cmp (gdouble x
,gdouble y
,const gdouble reltol
,const gdouble abstol
);
Compare x and y and return -1 if x < y, 0 if x == y and 1 if x > y,
all comparisons are done with precision prec
.
ncm_util_cvode_check_flag ()
gboolean ncm_util_cvode_check_flag (gpointer flagvalue
,const gchar *funcname
,gint opt
);
FIXME
ncm_util_basename_fits ()
gchar *
ncm_util_basename_fits (const gchar *fits_filename
);
Extracts the extension .fits or .fit from fits_filename
and returns
the prefix. If the extension is not found a copy of fits_filename
is
returned.
ncm_util_function_params ()
gchar * ncm_util_function_params (const gchar *func
,gdouble **x
,guint *len
);
Extracts the function name and its numerical parameters.
ncm_util_fact_size ()
gulong
ncm_util_fact_size (const gulong n
);
Calculate the smallest factorization of n
such that
$n_f = 2^\mu \times 3^\nu \times 5^\alpha \times 7^\beta$
and $n_f \geq n$.
This functions is useful to find a fft size such that fftw can optimized it more easily.
ncm_util_sleep_ms ()
void
ncm_util_sleep_ms (gint milliseconds
);
Suspend the thread execution for milliseconds
.
ncm_complex_dup ()
NcmComplex *
ncm_complex_dup (NcmComplex *c
);
Allocates a new complex number and copy the contents of c
to it.
ncm_complex_free ()
void
ncm_complex_free (NcmComplex *c
);
Frees c
, it should not be used on a statically allocated NcmComplex.
ncm_complex_clear ()
void
ncm_complex_clear (NcmComplex **c
);
Frees *c
and sets *c
to NULL, it should not be used on a statically allocated NcmComplex.
ncm_complex_set ()
void ncm_complex_set (NcmComplex *c
,const gdouble a
,const gdouble b
);
Sets c
to $a + I b$.
ncm_complex_res_add_mul_real ()
void ncm_complex_res_add_mul_real (NcmComplex * restrict c1
,const NcmComplex * restrict c2
,const gdouble v
);
Computes c1
= c1
+ c2
* v
, assuming that
c1
and c2
are different.
ncm_complex_res_add_mul ()
void ncm_complex_res_add_mul (NcmComplex * restrict c1
,const NcmComplex * restrict c2
,const NcmComplex * restrict c3
);
Computes c1
= c1
+ c2
* c3
, assuming that
c1
and c2
are different.
ncm_complex_mul_real ()
void ncm_complex_mul_real (NcmComplex *c
,const gdouble v
);
Computes c1
= c1
* v
.
ncm_complex_res_mul ()
void ncm_complex_res_mul (NcmComplex * restrict c1
,const NcmComplex * restrict c2
);
Computes c1
= c1
* c2
, assuming that
c1
and c2
are different.
ncm_util_smooth_trans ()
gdouble ncm_util_smooth_trans (gdouble f0
,gdouble f1
,gdouble z0
,gdouble dz
,gdouble z
);
ncm_util_smooth_trans_get_theta ()
void ncm_util_smooth_trans_get_theta (gdouble z0
,gdouble dz
,gdouble z
,gdouble *theta0
,gdouble *theta1
);
ncm_util_position_angle ()
gdouble ncm_util_position_angle (gdouble ra1
,gdouble dec1
,gdouble ra2
,gdouble dec2
);
Computes the on-sky position angle (East of North) between object1 (ra1
, dec1
) and object2 (ra2
, dec2).
The input coordinates ((ra1
, dec1
), (ra2
, dec2
)) must be given in decimal degrees.
ncm_util_great_circle_distance ()
gdouble ncm_util_great_circle_distance (gdouble ra1
,gdouble dec1
,gdouble ra2
,gdouble dec2
);
Compute the great circle distance (or separation, as defined in astropy) between poistion 1 (ra1
, dec1
) and position 2 (ra2
, dec2
).
See Great-circle distance, in particular the Vincenty equation (implemented here).
The input coordinates ((ra1
, dec1
), (ra2
, dec2
)) must be given in decimal degrees.
ncm_acb_get_complex()
#define ncm_acb_get_complex(z) (arf_get_d (arb_midref (acb_realref (z)), ARF_RND_NEAR) + I * arf_get_d (arb_midref (acb_imagref (z)), ARF_RND_NEAR))
NCM_TEST_GSL_RESULT()
#define NCM_TEST_GSL_RESULT(func,ret) if (ret != GSL_SUCCESS) g_error ("%s: %s", func, gsl_strerror (ret))
NCM_WRITE_INT32()
#define NCM_WRITE_INT32(_ff,_ii) G_STMT_START { gint32 _temp_i = GINT32_TO_BE ((_ii)); if (fwrite (&_temp_i, sizeof(gint32), (1), _ff) != 1) g_error ("NCM_WRITE_INT32: io error"); } G_STMT_END
NCM_WRITE_UINT32()
#define NCM_WRITE_UINT32(_ff,_ii) G_STMT_START { guint32 _temp_i = GUINT32_TO_BE ((_ii)); if (fwrite (&_temp_i, sizeof(guint32), (1), _ff) != 1) g_error ("NCM_WRITE_UINT32: io error"); } G_STMT_END
NCM_WRITE_INT64()
#define NCM_WRITE_INT64(_ff,_ii) G_STMT_START { gint64 _temp_i = GINT64_TO_BE ((_ii)); if (fwrite (&_temp_i, sizeof(gint64), (1), _ff) != 1) g_error ("NCM_WRITE_INT64: io error"); } G_STMT_END
NCM_WRITE_UINT64()
#define NCM_WRITE_UINT64(_ff,_ii) G_STMT_START { guint64 _temp_i = GUINT64_TO_BE ((_ii)); if (fwrite (&_temp_i, sizeof(guint64), (1), _ff) != 1) g_error ("NCM_WRITE_INT64: io error"); } G_STMT_END
NCM_WRITE_DOUBLE()
#define NCM_WRITE_DOUBLE(_ff,_ii) G_STMT_START { NcmDoubleInt64 _iii; _iii.x = _ii; _iii.i = GINT64_TO_BE ((_iii.i)); if (fwrite (&_iii.i, sizeof(gint64), (1), _ff) != 1) g_error ("NCM_WRITE_DOUBLE: io error"); } G_STMT_END
NCM_READ_INT32()
#define NCM_READ_INT32(_ff,_ii) G_STMT_START { gint32 _temp_i; if (fread (&_temp_i, sizeof(gint32), (1), _ff) != 1) g_error ("NCM_READ_INT32: io error"); _ii = GINT32_FROM_BE (_temp_i); } G_STMT_END
NCM_READ_UINT32()
#define NCM_READ_UINT32(_ff,_ii) G_STMT_START { guint32 _temp_i; if (fread (&_temp_i, sizeof(guint32), (1), _ff) != 1) g_error ("NCM_READ_UINT32: io error"); _ii = GUINT32_FROM_BE (_temp_i); } G_STMT_END
NCM_READ_INT64()
#define NCM_READ_INT64(_ff,_ii) G_STMT_START { gint64 _temp_i; if (fread (&_temp_i, sizeof(gint64), (1), _ff) != 1) g_error ("NCM_READ_INT64: io error"); _ii = GINT64_FROM_BE (_temp_i); } G_STMT_END
NCM_READ_UINT64()
#define NCM_READ_UINT64(_ff,_ii) G_STMT_START { guint64 _temp_i; if (fread (&_temp_i, sizeof(guint64), (1), _ff) != 1) g_error ("NCM_READ_UINT64: io error"); _ii = GUINT64_FROM_BE (_temp_i); } G_STMT_END
NCM_READ_DOUBLE()
#define NCM_READ_DOUBLE(_ff,_ii) G_STMT_START { NcmDoubleInt64 _iii; if (fread (&_iii.i, sizeof(gint64), (1), _ff) != 1) g_error ("NCM_READ_DOUBLE: io error"); _iii.i = GINT64_FROM_BE (_iii.i); _ii = _iii.x; } G_STMT_END
ncm_g_string_clear()
#define ncm_g_string_clear(s) G_STMT_START if (*(s) != NULL) { g_string_free (*(s), TRUE); *(s) = NULL; } G_STMT_END