NcmBinSplit

NcmBinSplit — Binnary splitting algorithms used to evaluate sums fast and with arbitrary precision.

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

struct NcmBinSplit
extern mpz_t NCM_BINSPLIT_ONE

Includes

#include <numcosmo/math/ncm_binsplit.h>

Description

This object implements a binary splitting algorithm to evaluate sums with arbitrary precision.

Functions

NcmBinSplitEval ()

void
(*NcmBinSplitEval) (NcmBinSplit *bs,
                    gulong n1,
                    gulong n2);

ncm_binsplit_alloc ()

NcmBinSplit *
ncm_binsplit_alloc (gpointer userdata);

Allocates a new NcmBinSplit.

[skip]

Parameters

userdata

user data to be passed to the NcmBinSplitEval function

 

Returns

a new NcmBinSplit.

[transfer full]


ncm_binsplit_test_next ()

glong
ncm_binsplit_test_next (NcmBinSplit *bs,
                        NcmBinSplitEval bs_eval,
                        gulong nt);

Computes the number of bits of precision that would be gained by adding nt terms to the sum.

[skip]

Parameters

bs

a NcmBinSplit

 

bs_eval

a NcmBinSplitEval

 

nt

number of terms to be added to the sum

 

Returns

number of bits of precision that would be gained by adding nt terms to the sum.


ncm_binsplit_join ()

void
ncm_binsplit_join (NcmBinSplit *bs,
                   NcmBinSplit *bs_l,
                   NcmBinSplit *bs_r);

Joins two NcmBinSplit objects, it is assumed that bs_l and bs_r are consecutive in the sum.

Parameters

bs

a NcmBinSplit

 

bs_l

a NcmBinSplit

 

bs_r

a NcmBinSplit

 

ncm_binsplit_eval_join ()

void
ncm_binsplit_eval_join (NcmBinSplit *bs,
                        NcmBinSplitEval bs_eval,
                        gulong nt);

Evaluates the sum of nt terms and joins the result to the sum stored in bs .

[skip]

Parameters

bs

a NcmBinSplit

 

bs_eval

a NcmBinSplitEval

 

nt

number of terms to be added to the sum

 

ncm_binsplit_eval_prec ()

gulong
ncm_binsplit_eval_prec (NcmBinSplit *bs,
                        NcmBinSplitEval bs_eval,
                        gulong step,
                        glong prec);

Evaluates the sum until the number of bits of precision is greater or equal to prec .

[skip]

Parameters

bs

a NcmBinSplit

 

bs_eval

a NcmBinSplitEval

 

step

number of terms to be added to the sum in each iteration

 

prec

number of bits of precision to be achieved

 

Returns

number of terms added to the sum.


ncm_binsplit_get ()

void
ncm_binsplit_get (NcmBinSplit *bs,
                  mpfr_t res);

Computes the value of the sum stored in bs and stores the result in res in the form of a mpfr_t.

[skip]

Parameters

bs

a NcmBinSplit

 

res

a mpfr_t arbitrary precision float

 

ncm_binsplit_get_q ()

void
ncm_binsplit_get_q (NcmBinSplit *bs,
                    mpq_t q);

Computes the value of the sum stored in bs and stores the result in q . The result is stored in the form of a mpq_t.

[skip]

Parameters

bs

a NcmBinSplit

 

q

a mpq_t arbitrary precision rational

 

ncm_binsplit_get_d ()

gdouble
ncm_binsplit_get_d (NcmBinSplit *bs,
                    mp_rnd_t rnd);

Computes the value of the sum stored in bs and stores the result in res in the form of a double.

[skip]

Parameters

bs

a NcmBinSplit

 

rnd

a mp_rnd_t rounding mode

 

Returns

the value of the sum stored in bs in the form of a double.


NCM_BINSPLIT_DECL()

#define NCM_BINSPLIT_DECL(name,v,u,n,data) static inline void name (mpz_t v, mpz_t u, gulong n, gpointer data)

NCM_BINSPLIT_DENC_NULL()

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

Types and Values

struct NcmBinSplit

struct NcmBinSplit {
};

FIXME


NCM_BINSPLIT_ONE

extern mpz_t NCM_BINSPLIT_ONE;