Especially, with the advent of many different and intricate Machine Learning algorithms, it is very hard to come up with your code to any problem. Therefore, the use of a library and its choice is imperative provision before you start the project. However, there are many different libraries having different quirks and rigs in different languages, even in multiple languages so that choice is not very straight forward as it seems.
Before you start, I strongly recommend you to experiment the library of your interest so as not to say " Ohh Buda!" at the end. For being a simple guide, I will point some possible libraries and signify some of them as my choices with the reason behind.
At that post, I try to illustrate one of the use case of comparison overriding for std::sort on top of a simple problem. Our problem is as follows:
Write a method to sort an array of strings so that all the anagrams are next to each other.
Suppose you have a vector array at C++ and you want to extract a sub-vector given some range. There is a simple illustration one of the possible way to do.
I've gathered the following from online research so far:
I've used Armadillo a little bit, and found the interface to be intuitive enough, and it was easy to locate binary packages for Ubuntu (and I'm assuming other Linux distros). I haven't compiled it from source, but my hope is that it wouldn't be too difficult. It meets most of my design criteria, and uses dense linear algebra. It can call LAPACK or MKL routines.
I've heard good things about Eigen, but haven't used it. It claims to be fast, uses templating, and supports dense linear algebra. It doesn't have LAPACK or BLAS as a dependency, but appears to be able to do everything that LAPACK can do (plus some things LAPACK can't). A lot of projects use Eigen, Continue reading Some possible Matrix Algebra libraries based on C/C++
Here I am sharing the code that I write while learning basics of the Thrust. It is self explanatory with its qualified comments.
You might just download the code here from my dropbox.
This code is crafted as I am learning THRUST Library and utilizing its great benefits with little effort on CUDA complexity. You might choose to download the code since I am so lazy to keep the code aligned below as it is pretty long. 🙁
./clock: error while loading shared libraries: libcudart.so.5.0: cannot open shared object file: No such file or directory
sudo ldconfig /usr/local/cuda/lib64^C
This article is for the ones who aim to use c++ in topcoder or any where else. http://pocket.co/soi6f
long long is not the same as
long (although they can have the same size, e.g. in most 64-bit POSIX system). It is just guaranteed that a
long long is at least as long as a
long. In most platforms, a
long long represents a 64-bit signed integer type.
You could use
long long to store the 8-byte value safely in most conventional platforms, but it's better to use
<cstdint> to clarify that you want an integer type having ≥64-bit.