NcmUtil

NcmUtil — Miscellaneous utilities.

Functions

gdouble * ncm_smoothd ()
gdouble ncm_topology_comoving_a0_lss ()
gdouble ncm_topology_sigma_comoving_a0_lss ()
gdouble ncm_sphPlm_x ()
gdouble ncm_sphPlm_test_theta ()
gdouble ncm_sum ()
gdouble ncm_numdiff_1 ()
gdouble ncm_numdiff_2 ()
gdouble ncm_numdiff_2_err ()
gdouble ncm_sqrt1px_m1 ()
gdouble ncm_cmpdbl ()
gdouble ncm_exprel ()
gdouble ncm_d1exprel ()
gdouble ncm_d2exprel ()
gdouble ncm_d3exprel ()
gsize ncm_mpfr_out_raw ()
gsize ncm_mpfr_inp_raw ()
gsize ncm_mpq_out_raw ()
gsize ncm_mpq_inp_raw ()
gulong ncm_random_seed ()
gint ncm_cmp ()
void ncm_rational_coarce_double ()
void ncm_mpz_inits ()
void ncm_mpz_clears ()
gboolean ncm_util_cvode_check_flag ()
gboolean ncm_util_cvode_print_stats ()
gchar * ncm_util_basename_fits ()
gchar * ncm_util_function_params ()
NcmComplex * ncm_complex_new ()
NcmComplex * ncm_complex_ref ()
NcmComplex * ncm_complex_dup ()
void ncm_complex_free ()
void ncm_complex_clear ()
gdouble ncm_complex_Re ()
gdouble ncm_complex_Im ()
gdouble ncm_util_smooth_trans ()
void ncm_util_smooth_trans_get_theta ()
#define exp10()
#define ncm_acb_get_complex()
#define ncm_util_exp10()
#define NCM_GARRAY_MEMCPY()
#define NCM_GARRAY_DUP()
#define ncm_assert_cmpdouble()
#define ncm_assert_cmpdouble_e()
#define NCM_RETURN_IF_INF()
#define NCM_FLOOR_TRUNC()
#define NCM_CEIL_TRUNC()
#define NCM_ROUND_TRUNC()
#define NCM_TEST_GSL_RESULT()
#define NCM_COMPLEX_INC_MUL_REAL_TEST()
#define NCM_COMPLEX_INC_MUL_REAL()
#define NCM_COMPLEX_INC_MUL()
#define NCM_COMPLEX_INC_MUL_MUL_REAL()
#define NCM_COMPLEX_MUL_REAL()
#define NCM_COMPLEX_MUL()
#define NCM_COMPLEX_ADD()
#define NCM_COMPLEX_MUL_CONJUGATE()
#define NCM_WRITE_INT32()
#define NCM_WRITE_UINT32()
#define NCM_WRITE_INT64()
#define NCM_WRITE_UINT64()
#define NCM_WRITE_DOUBLE()
#define NCM_READ_INT32()
#define NCM_READ_UINT32()
#define NCM_READ_INT64()
#define NCM_READ_UINT64()
#define NCM_READ_DOUBLE()
#define ncm_g_string_clear()
#define NCM_UNUSED()
#define NCM_TEST_FREE()
#define NCM_TEST_FAIL()
#define NCM_TEST_PASS()
#define NCM_CVODE_CHECK()
double ncm_util_KScdf ()
double ncm_util_KSfbar ()
void ncm_util_swilk ()

Types and Values

Object Hierarchy

    GBoxed
    ╰── NcmComplex

Description

Miscellaneous utility functions, macros and objects.

Functions

ncm_smoothd ()

gdouble *
ncm_smoothd (gdouble *in,
             size_t N,
             size_t points,
             size_t pass);

FIXME

Parameters

in

FIXME

 

N

FIXME

 

points

FIXME

 

pass

FIXME

 

Returns

FIXME


ncm_topology_comoving_a0_lss ()

gdouble
ncm_topology_comoving_a0_lss (guint n,
                              gdouble alpha);

FIXME

Parameters

n

FIXME

 

alpha

FIXME

 

Returns

FIXME


ncm_topology_sigma_comoving_a0_lss ()

gdouble
ncm_topology_sigma_comoving_a0_lss (guint n,
                                    gdouble alpha,
                                    gdouble sigma_alpha);

FIXME

Parameters

n

FIXME

 

alpha

FIXME

 

sigma_alpha

FIXME

 

Returns

FIXME


ncm_sphPlm_x ()

gdouble
ncm_sphPlm_x (gint l,
              gint m,
              gint order);

FIXME

Parameters

l

FIXME

 

m

FIXME

 

order

FIXME

 

Returns

FIXME


ncm_sphPlm_test_theta ()

gdouble
ncm_sphPlm_test_theta (gdouble theta,
                       gint lmax,
                       gint *lmin_data);

FIXME

Parameters

theta

FIXME

 

lmax

FIXME

 

lmin_data

FIXME

 

Returns

FIXME


ncm_sum ()

gdouble
ncm_sum (gdouble *d,
         gulong n);

FIXME

Parameters

d

FIXME

 

n

FIXME

 

Returns

FIXME


ncm_numdiff_1 ()

gdouble
ncm_numdiff_1 (gsl_function *F,
               const gdouble x,
               const gdouble ho,
               gdouble *err);

FIXME

[skip]

Parameters

F

FIXME

 

x

FIXME

 

ho

FIXME

 

err

FIXME

 

Returns

FIXME


ncm_numdiff_2 ()

gdouble
ncm_numdiff_2 (gsl_function *F,
               gdouble *ofx,
               const gdouble x,
               const gdouble ho,
               gdouble *err);

FIXME

[skip]

Parameters

F

FIXME

 

ofx

FIXME

 

x

FIXME

 

ho

FIXME

 

err

FIXME

 

Returns

FIXME


ncm_numdiff_2_err ()

gdouble
ncm_numdiff_2_err (gsl_function *F,
                   gdouble *ofx,
                   const gdouble x,
                   const gdouble ho,
                   gdouble err,
                   gdouble *ferr);

FIXME

[skip]

Parameters

F

FIXME

 

ofx

FIXME

 

x

FIXME

 

ho

FIXME

 

err

FIXME

 

ferr

FIXME

 

Returns

FIXME


ncm_sqrt1px_m1 ()

gdouble
ncm_sqrt1px_m1 (gdouble x);

Calculates $\sqrt{1+x}-1$ using the appropriated taylor series when $x \approx 1$.

Parameters

x

a real number $>-1$

 

Returns

$\sqrt{1+x}-1$.


ncm_cmpdbl ()

gdouble
ncm_cmpdbl (const gdouble x,
            const gdouble y);

Parameters

x

a double.

 

y

a double.

 

Returns

FIXME


ncm_exprel ()

gdouble
ncm_exprel (const gdouble x);

Parameters

x

a double

 

Returns

FIXME


ncm_d1exprel ()

gdouble
ncm_d1exprel (const gdouble x);

Parameters

x

a double

 

Returns

FIXME


ncm_d2exprel ()

gdouble
ncm_d2exprel (const gdouble x);

Parameters

x

a double

 

Returns

FIXME


ncm_d3exprel ()

gdouble
ncm_d3exprel (const gdouble x);

Parameters

x

a double

 

Returns

FIXME


ncm_mpfr_out_raw ()

gsize
ncm_mpfr_out_raw (FILE *stream,
                  mpfr_t op);

FIXME

[skip]

Parameters

stream

FIXME

 

op

FIXME

 

Returns

FIXME


ncm_mpfr_inp_raw ()

gsize
ncm_mpfr_inp_raw (mpfr_t rop,
                  FILE *stream);

FIXME

[skip]

Parameters

rop

FIXME

 

stream

FIXME

 

Returns

FIXME


ncm_mpq_out_raw ()

gsize
ncm_mpq_out_raw (FILE *f,
                 mpq_t q);

FIXME

[skip]

Parameters

f

FIXME

 

q

FIXME

 

Returns

FIXME


ncm_mpq_inp_raw ()

gsize
ncm_mpq_inp_raw (mpq_t q,
                 FILE *f);

FIXME

[skip]

Parameters

q

FIXME

 

f

FIXME

 

Returns

FIXME


ncm_random_seed ()

gulong
ncm_random_seed (void);

FIXME

Returns

FIXME


ncm_cmp ()

gint
ncm_cmp (gdouble x,
         gdouble y,
         gdouble reltol);

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 .

Parameters

x

a double.

 

y

a double.

 

reltol

relative precision.

 

Returns

-1, 0, 1.


ncm_rational_coarce_double ()

void
ncm_rational_coarce_double (gdouble x,
                            mpq_t q);

FIXME

[skip]

Parameters

x

FIXME

 

q

FIXME

 

ncm_mpz_inits ()

void
ncm_mpz_inits (mpz_t z,
               ...);

FIXME

[skip]

Parameters

z

FIXME

 

...

FIXME

 

ncm_mpz_clears ()

void
ncm_mpz_clears (mpz_t z,
                ...);

FIXME

[skip]

Parameters

z

FIXME

 

...

FIXME

 

ncm_util_cvode_check_flag ()

gboolean
ncm_util_cvode_check_flag (gpointer flagvalue,
                           const gchar *funcname,
                           gint opt);

FIXME

Parameters

flagvalue

FIXME

 

funcname

FIXME

 

opt

FIXME

 

Returns

FIXME


ncm_util_cvode_print_stats ()

gboolean
ncm_util_cvode_print_stats (gpointer cvode);

FIXME

Parameters

cvode

FIXME

 

Returns

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.

Parameters

fits_filename

a fits filename

 

Returns

prefix of fits_filename .

[transfer full]


ncm_util_function_params ()

gchar *
ncm_util_function_params (const gchar *func,
                          gdouble **x,
                          guint *len);

Extracts the function name and its numerical parameters.

Parameters

func

string representing function and its parameters

 

x

the parameters or NULL if none found.

[out][array][element-type double]

len

number of parameters.

[out caller-allocates]

Returns

function name or NULL if it fails.

[transfer full]


ncm_complex_new ()

NcmComplex *
ncm_complex_new (void);

Allocates a new complex number.

Returns

a new NcmComplex.

[transfer full]


ncm_complex_ref ()

NcmComplex *
ncm_complex_ref (NcmComplex *c);

ncm_complex_dup ()

NcmComplex *
ncm_complex_dup (NcmComplex *c);

Allocates a new complex number and copy the contents of c to it.

Parameters

c

a NcmComplex.

 

Returns

a new NcmComplex.

[transfer full]


ncm_complex_free ()

void
ncm_complex_free (NcmComplex *c);

Frees c , it should not be used on a statically allocated NcmComplex.

Parameters

c

a 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.

Parameters

c

a NcmComplex.

 

ncm_complex_Re ()

gdouble
ncm_complex_Re (NcmComplex *c);

Returns the real part of c .

Parameters

c

a NcmComplex.

 

Returns

Re$(c)$.


ncm_complex_Im ()

gdouble
ncm_complex_Im (NcmComplex *c);

Returns the imaginary part of c .

Parameters

c

a NcmComplex.

 

Returns

Im$(c)$.


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);

exp10()

#define exp10(x) (exp ((x) * M_LN10))

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_util_exp10()

#define ncm_util_exp10(x) (exp ((x) * M_LN10))

NCM_GARRAY_MEMCPY()

#define             NCM_GARRAY_MEMCPY(dest,src)

NCM_GARRAY_DUP()

#define             NCM_GARRAY_DUP(dest,src)

ncm_assert_cmpdouble()

#define             ncm_assert_cmpdouble(n1,cmp,n2)

ncm_assert_cmpdouble_e()

#define             ncm_assert_cmpdouble_e(n1,cmp,n2,epsilon)

NCM_RETURN_IF_INF()

#define NCM_RETURN_IF_INF(a) if (gsl_isinf(a)) return a

NCM_FLOOR_TRUNC()

#define NCM_FLOOR_TRUNC(a,b) (floor ((b) * (a)) / (b))

NCM_CEIL_TRUNC()

#define NCM_CEIL_TRUNC(a,b) (ceil ((b) * (a)) / (b))

NCM_ROUND_TRUNC()

#define NCM_ROUND_TRUNC(a,b) (round ((b) * (a)) / (b))

NCM_TEST_GSL_RESULT()

#define NCM_TEST_GSL_RESULT(func,ret) if (ret != GSL_SUCCESS) g_error ("%s: %s", func, gsl_strerror (ret))

NCM_COMPLEX_INC_MUL_REAL_TEST()

#define             NCM_COMPLEX_INC_MUL_REAL_TEST(a,b,c)

NCM_COMPLEX_INC_MUL_REAL()

#define             NCM_COMPLEX_INC_MUL_REAL(a,b,c)

NCM_COMPLEX_INC_MUL()

#define             NCM_COMPLEX_INC_MUL(a,b,c)

NCM_COMPLEX_INC_MUL_MUL_REAL()

#define             NCM_COMPLEX_INC_MUL_MUL_REAL(a,b,c,d)

NCM_COMPLEX_MUL_REAL()

#define             NCM_COMPLEX_MUL_REAL(a,b,c)

NCM_COMPLEX_MUL()

#define             NCM_COMPLEX_MUL(a,b)

NCM_COMPLEX_ADD()

#define             NCM_COMPLEX_ADD(a,b)

NCM_COMPLEX_MUL_CONJUGATE()

#define             NCM_COMPLEX_MUL_CONJUGATE(a,b)

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

NCM_UNUSED()

#define NCM_UNUSED(x) (void)(x)

NCM_TEST_FREE()

#define             NCM_TEST_FREE(cmd,obj)

NCM_TEST_FAIL()

#define             NCM_TEST_FAIL(cmd)

NCM_TEST_PASS()

#define             NCM_TEST_PASS(cmd)

NCM_CVODE_CHECK()

#define             NCM_CVODE_CHECK(chk,name,val,ret)

ncm_util_KScdf ()

double
ncm_util_KScdf (int n,
                double x);

[skip]

Parameters

n

FIXME

 

x

FIXME

 

ncm_util_KSfbar ()

double
ncm_util_KSfbar (int n,
                 double x);

[skip]

Parameters

n

FIXME

 

x

FIXME

 

ncm_util_swilk ()

void
ncm_util_swilk (double *x,
                int n,
                double *w,
                double *pw,
                int *ifault);

Types and Values

KOLMOGOROVSMIRNOVDIST_H

#define KOLMOGOROVSMIRNOVDIST_H