Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For someone who wants to learn "modern C++", particularly for number-crunching, without a strong C background (say... someone who develops predictive models who mostly writes Python and Java, not that I resemble that or anything...) – where would be a good place to start?


I am not the best person to ask, but probably with Stroustroup's recent book on Modern C++. From what I hear, he discusses the philosophy behind C++ and presents things from the perspective of, "Here's how I suggest you use C++ today." (FWIW, I happen to mostly agree with the comments elsewhere in this thread about C++ being a colossal clusterfuck of complexity ... but still thought I'd answer your question best I could).


Yeah, I have that suspicion too, and I secretly hope a language like Julia makes all of this moot: but the question I'm trying to find an answer for is "what language should I use for large-scale-but-not-distributed matrix factorization" without giving up and resorting to Fortran.


Bjarne Stroustrup has a new book that came out with the C++11 standard called 'A Tour of C++'. For someone who is just starting I think its a great starting point as it is literally a tour of C++11 (less than 200 pages). It basically gives a very high level overview of everything C++ has to offer as well as some best practices for 'Modern C++'.

While it will take a lot more that just this book to get anywhere I think its a good starting point for anyone with experience with other programming languages who want to see what C++ has to offer.


0. Books--one of these: http://isocpp.org/get-started

Personally, if you aren't new to programming per se, I'd go with "C++ Primer" by Lippman/Lajoie/Moo since it smoothly integrates modern C++11 throughout the entire text (instead of sticking it into a separate section, as some of the other books do).

After that, "C++ Concurrency in Action: Practical Multithreading" by Anthony Williams: http://www.manning.com/williams/

...and then the rest of the books from the isocpp list (e.g., Josuttis).

1. Libraries:

The rich ecosystem of available libraries is one of my primary reasons for using C++ for numerics :-)

In fact, it's rich enough that it may be best if you were to specify what kind of number crunching you're interested in -- right now I can only try to give you a very broad/big-picture list of some that I've found useful.

The Standard Library supports (P)RNG with a variety of statistical distributions: http://en.cppreference.com/w/cpp/numeric/random

- Boost.Math Toolkit: http://boost.org/libs/math // and more broadly: http://boost.org/doc/libs/?view=category_Math // and even more broadly ;-): http://www.boost.org/doc/libs/?view=categorized - Eigen: http://eigen.tuxfamily.org/ - GPGPU: http://www.soa-world.de/echelon/2014/04/c-accelerator-librar... - MLPACK: http://mlpack.org/ - NLopt: http://ab-initio.mit.edu/wiki/index.php/NLopt_C-plus-plus_Re... - OpenCV: http://opencv.org/ - Odeint: http://www.odeint.com/ - POCO: http://pocoproject.org/ // note: not numerics, but when you need to exchange data over the net/web, these are pretty good for that :-) - QuantLib: http://quantlib.org/ // note: QuantLib is primarily for quantitative finance, but also has math components: http://quantlib.org/reference/group__math.html - SOCI: http://soci.sourceforge.net/ // note: not numerics, but for when you need database access, it has pretty clean API and is easy to use :-)

2. Talks:

* C9 Going Native: http://channel9.msdn.com/Shows/C9-GoingNative

In particular: + "Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11, and C++14" - http://channel9.msdn.com/Events/GoingNative/2013

+ "Sean Parent - C++ Seasoning" - http://channel9.msdn.com/Events/GoingNative/2013/Cpp-Seasoni...

* BoostCon / C++Now!: https://github.com/boostcon/

There's _lots_ of interesting talks, so explore yourself :-)

For instance, 2013 Keynote: "Dan Quinlan: C++ Use in High Performance Computing Within DOE: Past and Future" // http://2013.cppnow.org/session/keynote/

// IMHO, it's worth watching these for staying up to date with the broader developments in the field -- e.g., according to the speaker (given who he is I'd assume credibility) most national labs, including Lawrence Livermore National Laboratory in particular, are quite actively adopting C++ (not C) and have been turning away from Fortran for some time now.

HTH! :-)


Thank you so much!

(To answer your question: linear algebra and optimization. I do a lot of Numpy right now, and I see Eigen in my future...)


I wouldn't even bother. Most people just use C for number crunching.


Well, most of the number crunching code running on the biggest supercomputers today is actually Fortran code - in the meteorology field, for example, virtually all atmospheric models are implemented in Fortran.


My former field's solid-state physics and that's the same deal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: