Git Product home page Git Product logo

cuba's Introduction

Cuba - a library for multidimensional numerical integration

Cuba was written by Thomas Hahn and is distributed under the LGPL (see COPYING). Refer to the main website http://www.feynarts.de/cuba/

Installing

To build libcuba.so, run:

$ ./configure
$ ./makeshared.sh # (instead of make)

To use Cuba with Python, see the PyCuba project and its documentation.

cuba's People

Contributors

johannesbuchner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cuba's Issues

Upgrade to 4.2

I notice on http://www.feynarts.de/cuba/ that version 4.2 is already available, but the code is not in this github repository. Is this repository discontinued?

I am trying to make sure the Mainz P2 geant4 simulations have proper dependencies... this is one of them, but 4.2 is required.

userdata

I would like to ask a question about how to use userdata argument in cuba subroutines
Please tell me if you can help me in this problem
Thank you for your cooperation

Linker problem

Gcc version 10.2.1 during compilation throws some errors of the type:
gcc -O3 -fomit-frame-pointer -ffast-math -Wall -DHAVE_CONFIG_H -I./src/common -I. -I. -o demo-c ./demo/demo-c.c libcuba.a -lm
/usr/bin/ld: libcuba.a(Suave.o):(.bss+0x0): multiple definition of cubafun_; libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: libcuba.a(Divonne.o):(.bss+0x0): multiple definition of cubafun_; libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: libcuba.a(Cuhre.o):(.bss+0x0): multiple definition of cubafun_; libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: libcuba.a(Fork.o):(.bss+0x0): multiple definition of cubafun_; libcuba.a(Vegas.o):(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [makefile:269: demo-c] Error 1

Probably new default of Gcc -fno-common is causing the problem.

Undefined log_finite

Hi Johannes,

I build the shared libcuba.so with according to your instructions but when
trying to import pycuba in python I get this error:

OSError: /usr/local/lib/libcuba.so: undefined symbol: _ZGVbN2v___log_finite

nm -CD on /usr/local/lib/libcuba.so indeed flags up a few undefined bits:
U _ZGVbN2v___log_finite
U __exp_finite
U __pow_finite
U __powl_finite

Do you happen to know which library provides these symbols?

Thanks,
Holger

How to integrate a function with parameter?

Hi folks,

I would like to know the general advice on the parameter scan for the Integrand with parameters.
For example, I would like to obtain the results of a 2-D integral for a function of form F(x1, x2, a), with a parameter which I would like to scan over.
Is that possible to do the parameter scan in a single compilation? I am using C/C++ interface.

Thanks,
Haolin

problem with the creation of libcuba.so

Hello!
I tried to install pymultinest in virtual machine (linux). But when I get to pycuba library creation, it does not make the libcuba.so in the directory when using ./makesharedlib.sh. And I guess that gives me the typical errors:

OSError: libcuba.so: cannot open shared object file: No such file or directory

WhatsApp Image 2023-09-05 at 19 41 09(1)

I hope you can help me with it.

Potential NDIM related bug in Cuba-Cuhre

I am trying to integrate a 1D vector function in cuba. I get correct results when I set NDIM=2 but I get incorrect results with NDIM=1. I have reproduced a minimal working example below.

#include <iostream>
#include <cmath>
#include "cuba.h"

#define NDIM 2 //changing this to 1 gives incorrect result!
#define NCOMP 12
#define NVEC 1
#define EPSREL 1e-6
#define EPSABS 0
#define VERBOSE 0
#define LAST 4

#define MINEVAL 0
#define MAXEVAL 50000
#define STATEFILE NULL
#define SPIN NULL
#define KEY 0

static int f12(const int *ndim, const double xx[],
  const int *ncomp, double ff[], void *p) {
  
  for(int i=0;i<12;i++)
    ff[i] = 1.0/(1.0+i*xx[0]*xx[0]);
  
  return 0;
}

int main(int argc, char **argv)
{
  int comp, nregions, neval, fail;
  double integral[12], error[12], prob[12];
    
  Cuhre(NDIM, NCOMP, f12, NULL, NVEC,
    EPSREL, EPSABS, VERBOSE | LAST,
    MINEVAL, MAXEVAL, KEY,
    STATEFILE, SPIN,
    &nregions, &neval, &fail, integral, error, prob);
    
  for(int i=0;i<12;i++) printf("%lf ",integral[i]); printf("\n");

  return 0;
}

Changing value of NDIM to 1 gives wrong result. I haven't looked for the bug in the source code yet.

Thank you for your attention.

libcuba.a file build problem

I'm on windows and I tried building the Cuba lib file using the following commands:
./configure
make

The first command worked successfully but the make command generated the following error at the end:

.....
gcc -O3 -fomit-frame-pointer -ffast-math -Wall -DHAVE_CONFIG_H -DREALSIZE=8 -I./src/common -I. -I. -I./src/cuhre -DLONGLONGINT -c -o llCuhre_.o ./src/cuhre/Cuhre.c
ar rv libcuba.a llCuhre_.o
a - llCuhre_.o
rm -f llCuhre_.o
gcc -O3 -fomit-frame-pointer -ffast-math -Wall -DHAVE_CONFIG_H -DREALSIZE=8 -I./src/common -I. -I. -DNOUNDERSCORE -c -o Fork.o ./src/common/Fork.c
In file included from ./src/common/Fork.c:11:0:
./src/common/Fork.c: In function 'cubawait':
./src/common/stddecl.h:193:29: error: 'cubafun_' undeclared (first use in this function)
#define MasterExit() do if( cubafun_.init ) {
^
./src/common/Fork.c:160:3: note: in expansion of macro 'MasterExit'
MasterExit();
^~~~~~~~~~
./src/common/stddecl.h:193:29: note: each undeclared identifier is reported only once for each function it appears in
#define MasterExit() do if( cubafun_.init ) {
^
./src/common/Fork.c:160:3: note: in expansion of macro 'MasterExit'
MasterExit();
^~~~~~~~~~
makefile:254: recipe for target 'libcuba.a(Fork.o)' failed
make: *** [libcuba.a(Fork.o)] Error 1

I don't understand what the problem is and how can it be fixed so that libcuba.a file is generated at the end?

xgiven can't be used

xgiven for Divonne can't be used (at least in recent versions of python) because the copy to ctypes fails.

I believe the fix is to change line 277 of init.py to:
xgiven = (c_double * ngiven)(*xgiven)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.