Top |
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$.
gdouble ncm_util_1pcosx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 + \cos(x)$ using the appropriated taylor series when $\cos(x) \approx -1$.
gdouble ncm_util_1mcosx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 - \cos(x)$ using the appropriated taylor series when $\cos(x) \approx 1$.
gdouble ncm_util_1psinx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 + \sin(x)$ using the appropriated taylor series when $\sin(x) \approx -1$.
gdouble ncm_util_1msinx (const gdouble sinx
,const gdouble cosx
);
Calculates $1 - \sin(x)$ using the appropriated taylor series when $\sin(x) \approx 1$.
gdouble ncm_util_cos2x (const gdouble sinx
,const gdouble cosx
);
Calculates $\cos(2x)$ using the appropriated taylor series when $\sin(x) \approx 1$.
gdouble ncm_cmpdbl (const gdouble x
,const gdouble y
);
Compares x
and y
and returns the difference between them
relative to their mean.
gdouble
ncm_exprel (const gdouble x
);
Computes the relative exponential $(\exp(x) - 1)/x$.
gdouble
ncm_d1exprel (const gdouble x
);
Computes the first derivative of the relative exponential $(\exp(x) - 1)/x$.
gdouble
ncm_d2exprel (const gdouble x
);
Computes the second derivative of the relative exponential $(\exp(x) - 1)/x$.
gdouble
ncm_d3exprel (const gdouble x
);
Computes the third derivative of the relative exponential $(\exp(x) - 1)/x$.
gdouble
ncm_util_sinh1 (const gdouble x
);
Computes $\frac{\sinh(x)}{x}$. For small values of x
the taylor series is used.
For large values of x
the value is computed using the standard library function.
void ncm_util_mln_1mIexpzA_1pIexpmzA (const gdouble rho
,const gdouble theta
,const gdouble A
,gdouble *rho1
,gdouble *theta1
);
Computes $$z_1 = z - \ln\left(\frac{1-i e^{+z} A}{1+i e^{-z} A}\right),$$ where $z = \rho + i\theta$
and return the new $z_1 = \rho_1 + i\theta_1$ into rho1
and $\theta1$.
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 reltol
and abstol
.
void ncm_rational_coarce_double (gdouble x
,mpq_t q
);
Computes a rational approximation for x
and stores the result in q
.
[skip]
void ncm_mpz_inits (mpz_t z
,...
);
Initializes z
and all the mpz_t in the list.
[skip]
void ncm_mpz_clears (mpz_t z
,...
);
Clears z
and all the mpz_t in the list.
[skip]
gboolean ncm_util_cvode_check_flag (gpointer flagvalue
,const gchar *funcname
,gint opt
);
Checks the CVode flag value and prints a message if an error occured.
gboolean
ncm_util_cvode_print_stats (gpointer cvode
);
Prints the statistics of the CVodeMem object cvode
.
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.
gchar * ncm_util_function_params (const gchar *func
,gdouble **x
,guint *len
);
Extracts the function name and its numerical parameters.
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.
void
ncm_util_sleep_ms (gint milliseconds
);
Suspend the thread execution for milliseconds
.
NcmComplex *
ncm_complex_dup (NcmComplex *c
);
Allocates a new complex number and copy the contents of c
to it.
void
ncm_complex_free (NcmComplex *c
);
Frees c
, it should not be used on a statically allocated NcmComplex.
void
ncm_complex_clear (NcmComplex **c
);
Frees *c
and sets *c
to NULL, it should not be used on a statically allocated NcmComplex.
void ncm_complex_set (NcmComplex *c
,const gdouble a
,const gdouble b
);
Sets c
to $a + I b$.
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.
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.
void ncm_complex_mul_real (NcmComplex *c
,const gdouble v
);
Computes c1
= c1
* v
.
void ncm_complex_res_mul (NcmComplex * restrict c1
,const NcmComplex * restrict c2
);
Computes c1
= c1
* c2
, assuming that
c1
and c2
are different.
gdouble ncm_util_smooth_trans (gdouble f0
,gdouble f1
,gdouble z0
,gdouble dz
,gdouble z
);
void ncm_util_smooth_trans_get_theta (gdouble z0
,gdouble dz
,gdouble z
,gdouble *theta0
,gdouble *theta1
);
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.
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.
#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))