Good maths library

Discussion in 'C++' started by NEG, Oct 26, 2010.

  1. NEG

    NEG Guest

    Hi
    I need a good, fast maths library.
    It would be great if it's written in c++ but c will be very good too.
    I've already looked at GSL but as I understood it won't run on msvc but
    I need support for both win and nix platforms. Especially for win
    because there are no *nixes as desktops there.
    Lib should support cubic interpolation, distributions, matrices, random
    number generators.

    Thank you in advance

    Anton I.
    NEG, Oct 26, 2010
    #1
    1. Advertising

  2. NEG <> wrote:
    > I need a good, fast maths library.
    > It would be great if it's written in c++ but c will be very good too.
    > I've already looked at GSL but as I understood it won't run on msvc but
    > I need support for both win and nix platforms. Especially for win
    > because there are no *nixes as desktops there.
    > Lib should support cubic interpolation, distributions, matrices, random
    > number generators.


    I don't know if it will suit your needs, but check the PARI library:
    http://pari.math.u-bordeaux.fr/
    Juha Nieminen, Oct 26, 2010
    #2
    1. Advertising

  3. NEG

    Jeff Flinn Guest

    NEG wrote:
    > Hi
    > I need a good, fast maths library.
    > It would be great if it's written in c++ but c will be very good too.
    > I've already looked at GSL but as I understood it won't run on msvc but
    > I need support for both win and nix platforms. Especially for win
    > because there are no *nixes as desktops there.
    > Lib should support cubic interpolation, distributions, matrices, random
    > number generators.


    Does http://www.boost.org/doc/libs/1_44_0/libs/math/doc/html/index.html
    provide what you are looking for.

    Jeff
    Jeff Flinn, Oct 26, 2010
    #3
  4. NEG

    Daniel Guest

    On Oct 25, 7:07 pm, NEG <> wrote:
    > Hi
    > I need a good, fast maths library.
    > I need support for both win and nix platforms. Especially for win
    >
    > Anton  I.


    Below are some of the libraries I've found useful, and have managed to
    compile with VC++ version 8, with more or less difficulty.

    For distributions, I highly recommend cephes cprob,

    http://www.netlib.org/cephes/

    You can use boost for the major distributions, but don't rely on
    boost::math::quantile for the inverse, in particular,

    const boost::math::students_t dist(dof);
    const double t = boost::math::quantile(dist, y);

    is pathological. The inverse functions in cephes are excellent.

    For non linear solvers, have a look at:

    asa (Adaptive Simulated Annealing)- http://sourceforge.net/projects/asa-caltech/

    minuit - http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/minmain.html

    levmar (Levenberg-Marquardt ) http://www.ics.forth.gr/~lourakis/levmar/

    brent solver - http://www.netlib.org/c/

    The brent solver is generally fast, but doesn't always converge for a
    difficult function. I've found asa very reliable for difficult
    functions in one parameter, if there's a global minimum, it finds it.
    I've had good experience with minuit for multi-dimensional non-linear
    problems. In general you need more than one solver in your toolkit,
    it's worthwhile taking the time to wrap them so that you can easily
    replace one with another.

    lapack (http://www.netlib.org/lapack/) provides excellent linear
    algrebra routines, I'd suggest downloading lapack-3.2.1-CMAKE.zip and
    figuring out how to use CMAKE http://www.cmake.org/cmake/help/runningcmake.html.

    It would be nice to have a C++ matrix library that nicely wraps the
    lapack data structures, but I haven't found one, boost's ublas is
    unfortunately not it.

    For a few hundred dollars, you can get a very high quality
    implementation of the lapack routines with Intel's math library
    http://software.intel.com/en-us/articles/intel-mkl/. You'll easily
    get a 3x or more performance improvement running an lapack routine,
    more if you have multiple cores and are using the parallel version of
    the library.

    I'd suggest buying a copy of Numerical Recipes, third editon,
    http://www.nr.com/, and the downloadable source. I really dislike the
    NR coding conventions, I use it sparringly, and rewrite what I do
    use. But if you need something, say cubic spline interpolation,
    you'll find it here. I do recommend the NR random number generators,
    primarily because they've been so widely used and vetted, and are
    known to be reliable.

    -- Daniel
    Daniel, Oct 27, 2010
    #4
  5. NEG

    Martin B. Guest

    On 26.10.2010 01:07, NEG wrote:
    > Hi
    > I need a good, fast maths library.
    > It would be great if it's written in c++ but c will be very good too.
    > I've already looked at GSL but as I understood it won't run on msvc but
    > I need support for both win and nix platforms. Especially for win
    > because there are no *nixes as desktops there.
    > Lib should support cubic interpolation, distributions, matrices, random
    > number generators.
    >


    Have a look at ALGLIB: http://www.alglib.net/

    I only use it for interpolation, but it works fine on VS2005.

    br,
    Martin
    Martin B., Oct 27, 2010
    #5
  6. NEG

    Anton Ivanov Guest

    Ok, thank you all
    looks like I'll use alglib for interpolation and boost for other things
    Anton Ivanov, Oct 27, 2010
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ross Clement (Email address invalid - do not use)

    Maths expression drawing library

    Ross Clement (Email address invalid - do not use), Jan 11, 2006, in forum: Java
    Replies:
    4
    Views:
    601
    Vyacheslav Levitsky
    Oct 2, 2006
  2. Calum Maciver

    Maths Involved

    Calum Maciver, Feb 18, 2006, in forum: Java
    Replies:
    5
    Views:
    456
    Luke Webber
    Feb 19, 2006
  3. Andrew Bullock

    bit of a maths quesiton

    Andrew Bullock, Feb 5, 2005, in forum: C++
    Replies:
    2
    Views:
    308
    Victor Bazarov
    Feb 5, 2005
  4. Geoff

    Maths in HTML

    Geoff, Jan 4, 2007, in forum: HTML
    Replies:
    10
    Views:
    712
    Adrienne Boswell
    Jan 6, 2007
  5. Rory Campbell-Lange

    Maths error

    Rory Campbell-Lange, Jan 8, 2007, in forum: Python
    Replies:
    36
    Views:
    992
    Nick Maclaren
    Jan 16, 2007
Loading...

Share This Page