Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Before you mark question as off-topic, please read it - it is, actually, quant-related.

Basically, I'm working on an app that spits out a lot of C++ math. When it comes to simple things like exponents and trig, I can use an STL function. But when it comes to things like matrix operations or normal distributions or anything else that's not part of the STL, I'm not quite sure which library to support.

That's the reason for this question - I'd like to know what kind of C++ libs quants typically use (in addition to the STL and such) most. My idea is to support those which are the most common. (I'm thinking of things like BLAS, MKL, Boost.Math, etc.)

BTW, if anyone's interested, here's an overview of what I'm building.

share|improve this question
Looks interesting! – Bob Jansen Jan 12 '12 at 10:32
up vote 17 down vote accepted

For linear algebra etc, I am partial to Armadillo with Eigen as an alternative. Both are modern (eg templated), actively developed and fairly high-performance.

I like my C++ together with R and stand behind a few projects like Rcpp and RInside which facilitate that integration; RcppArmadillo then brings Armadillo to R.

For quant stuff, there is of course QuantLib and my (too slow-moving :-/) RQuantLib.

share|improve this answer
Hey Dirk, I thought R already used BLAS. If so, what does Armadillo add for an R user? – chrisaycock Jan 10 '12 at 23:06
It helps to look at it the other way: RcppArmadillo helps you to write simple C++ linear algebra, almost Matlab style, that is C++ fast. At run-time, it will indeed refer to whichever BLAS R uses, which may well be optimised, multicore, ... such as Goto or MKL. Makes sense? So the point is when you need to code something that R doesn't yet do, or does too slowly, the RcppArmadillo integration makes it pretty easy to get the job done. – Dirk Eddelbuettel Jan 10 '12 at 23:21
So, you're just advocating C++ over R, eh? ;) – chrisaycock Jan 11 '12 at 0:02
Nope, I advocate using C++ and R. A happy marriage. ;-) – Dirk Eddelbuettel Jan 11 '12 at 0:03
I have worked with C++ for twenty years and your statement still makes no sense to me. Why don't you focus on release early, release often and feedback on actual code? – Dirk Eddelbuettel Jan 11 '12 at 17:37

What I use in my job:

  • boost (the mathematical part)

  • Eigen

  • gsl

  • glpk

and some scary legacy code ;-)

share|improve this answer

The NAG library is quite commonly used

share|improve this answer

For many numerical procedures you can link against Octave libraries if Octave is installed.

share|improve this answer
While technically true, you should keep in mind that Octave is written to support its interpreter, not provide an API. Hence little use of Octave as a library in the sense of the original question. – Dirk Eddelbuettel Jan 11 '12 at 18:02

There's also the Intel math libraries.

share|improve this answer
Could you please provide some links to enhance a bit the content of your answer? – SRKX Aug 25 '13 at 9:04

Just wanted to add one more library that may be of interest: http://www.yeppp.info/. It's not strictly a quant library but a:

"SIMD-optimized mathematical library for x86, ARM, and MIPS processors on Windows, Android, Mac OS X, and GNU/Linux systems."

share|improve this answer

On my capstone project on Extreme Value Theory, LMM and Swap Pricing I used dlib . It has a lot of various mathematical capabilities. My use focused on vector and optimization calculations.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.