Template library for linear algebra: vectors, matrices, and related algorithms