AcouSTO  version 2.0
cubature.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include "cubature.h"
Include dependency graph for cubature.c:

Go to the source code of this file.

Data Structures

struct  esterr
 
struct  hypercube
 
struct  region
 
struct  rule_s
 
struct  rule75genzmalik
 
struct  heap
 
struct  fv_data_s
 

Macros

#define SUCCESS   0
 
#define FAILURE   1
 
#define num0_0(dim)   (1U)
 
#define numR0_0fs(dim)   (2 * (dim))
 
#define numRR0_0fs(dim)   (2 * (dim) * (dim-1))
 
#define numR_Rfs(dim)   (1U << (dim))
 
#define real(x)   ((double)(x))
 
#define to_int(n)   ((int)(n))
 
#define KEY(hi)   ((hi).errmax)
 

Typedefs

typedef int(* evalError_func) (struct rule_s *r, unsigned fdim, integrand_v f, void *fdata, unsigned nR, region *R)
 
typedef void(* destroy_func) (struct rule_s *r)
 
typedef struct rule_s rule
 
typedef region heap_item
 
typedef struct fv_data_s fv_data
 

Functions

static double relError (esterr ee)
 
static double errMax (unsigned fdim, const esterr *ee)
 
static double compute_vol (const hypercube *h)
 
static hypercube make_hypercube (unsigned dim, const double *center, const double *halfwidth)
 
static hypercube make_hypercube_range (unsigned dim, const double *xmin, const double *xmax)
 
static void destroy_hypercube (hypercube *h)
 
static region make_region (const hypercube *h, unsigned fdim)
 
static void destroy_region (region *R)
 
static int cut_region (region *R, region *R2)
 
static void destroy_rule (rule *r)
 
static int alloc_rule_pts (rule *r, unsigned num_regions)
 
static rulemake_rule (size_t sz, unsigned dim, unsigned fdim, unsigned num_points, evalError_func evalError, destroy_func destroy)
 
static int eval_regions (unsigned nR, region *R, integrand_v f, void *fdata, rule *r)
 
static unsigned ls0 (unsigned n)
 
static void evalR_Rfs (double *pts, unsigned dim, double *p, const double *c, const double *r)
 
static void evalRR0_0fs (double *pts, unsigned dim, double *p, const double *c, const double *r)
 
static void evalR0_0fs4d (double *pts, unsigned dim, double *p, const double *c, const double *r1, const double *r2)
 
static int isqr (int x)
 
static void destroy_rule75genzmalik (rule *r_)
 
static int rule75genzmalik_evalError (rule *r_, unsigned fdim, integrand_v f, void *fdata, unsigned nR, region *R)
 
static rulemake_rule75genzmalik (unsigned dim, unsigned fdim)
 
static int rule15gauss_evalError (rule *r, unsigned fdim, integrand_v f, void *fdata, unsigned nR, region *R)
 
static rulemake_rule15gauss (unsigned dim, unsigned fdim)
 
static void heap_resize (heap *h, unsigned nalloc)
 
static heap heap_alloc (unsigned nalloc, unsigned fdim)
 
static void heap_free (heap *h)
 
static int heap_push (heap *h, heap_item hi)
 
static int heap_push_many (heap *h, unsigned ni, heap_item *hi)
 
static heap_item heap_pop (heap *h)
 
static int ruleadapt_integrate (rule *r, unsigned fdim, integrand_v f, void *fdata, const hypercube *h, unsigned maxEval, double reqAbsError, double reqRelError, double *val, double *err, int parallel)
 
static int integrate (unsigned fdim, integrand_v f, void *fdata, unsigned dim, const double *xmin, const double *xmax, unsigned maxEval, double reqAbsError, double reqRelError, double *val, double *err, int parallel)
 
int adapt_integrate_v (unsigned fdim, integrand_v f, void *fdata, unsigned dim, const double *xmin, const double *xmax, unsigned maxEval, double reqAbsError, double reqRelError, double *val, double *err)
 
static void fv (unsigned ndim, unsigned npt, const double *x, void *d_, unsigned fdim, double *fval)
 
int adapt_integrate (unsigned fdim, integrand f, void *fdata, unsigned dim, const double *xmin, const double *xmax, unsigned maxEval, double reqAbsError, double reqRelError, double *val, double *err)