tAdded C++ Eigen3 and Armadillo implementations, verified - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 2f91c02ec1ef61628279942caaba7acf18bf6041
 (DIR) parent 64d8741235c18b77a31c21f83ac473297f678c72
 (HTM) Author: Anders Damsgaard Christensen <adc@geo.au.dk>
       Date:   Sat, 16 Feb 2013 23:02:17 +0100
       
       Added C++ Eigen3 and Armadillo implementations, verified
       
       Diffstat:
         M matrixmul/Makefile                  |      23 ++++++++++++++++++++++-
         A matrixmul/cpp-armadillo.cpp         |      32 +++++++++++++++++++++++++++++++
         A matrixmul/cpp-eigen.cpp             |      33 +++++++++++++++++++++++++++++++
         M matrixmul/plot.gp                   |       2 ++
       
       4 files changed, 89 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/matrixmul/Makefile b/matrixmul/Makefile
       t@@ -18,7 +18,7 @@ CXX=g++
        CFLAGS=-Wall -O3 -march=native
        CXXFLAGS=-Wall -O3 -march=native
        
       -performance.png: plot.gp lua-arrofarrs.dat lua-linarr.dat luajit-arrofarrs.dat luajit-linarr.dat c-arrofarrs.dat c-linarr.dat c-omp-arrofarrs.dat c-omp-linarr.dat c-gsl-cblas.dat julia.dat cpp-vectorofvectors.dat cpp-linvectors.dat python-numpy.dat octave.dat cputhreads.sh cpumodel.sh
       +performance.png: plot.gp lua-arrofarrs.dat lua-linarr.dat luajit-arrofarrs.dat luajit-linarr.dat c-arrofarrs.dat c-linarr.dat c-omp-arrofarrs.dat c-omp-linarr.dat c-gsl-cblas.dat julia.dat cpp-vectorofvectors.dat cpp-linvectors.dat cpp-eigen.dat python-numpy.dat octave.dat cputhreads.sh cpumodel.sh
                gnuplot -e "platform='$(shell uname -norm)'; threads='$(shell ./cputhreads.sh)'; cpumodel='$(shell ./cpumodel.sh)'" plot.gp
        
        # Lua: Matrices as arrays of arrays
       t@@ -138,6 +138,27 @@ cpp-linvectors.dat: cpp-linvectors
                  echo $$dims; \
                done
        
       +# C++: Eigen
       +cpp-eigen.dat: cpp-eigen
       +        # cpp-eigen
       +        @rm -f $@
       +        @for dims in $(MATRIXDIMS_FAST); do \
       +          $(PREFIXCMD) $@ -f "$$dims %e" ./$< $$dims; \
       +          echo $$dims; \
       +        done
       +
       +# C++: Armadillo
       +cpp-armadillo.dat: cpp-armadillo
       +        # cpp-armadillo
       +        @rm -f $@
       +        @for dims in $(MATRIXDIMS_FAST); do \
       +          $(PREFIXCMD) $@ -f "$$dims %e" ./$< $$dims; \
       +          echo $$dims; \
       +        done
       +
       +cpp-armadillo: cpp-armadillo.cpp
       +        $(CXX) $(CXXFLAGS) -larmadillo $< -o $@
       +
        # Python: Numpy module
        python-numpy.dat: python-numpy.py
                # python-numpy.py
 (DIR) diff --git a/matrixmul/cpp-armadillo.cpp b/matrixmul/cpp-armadillo.cpp
       t@@ -0,0 +1,32 @@
       +#include <iostream>
       +#include <cstdlib>
       +#include <armadillo>
       +
       +int main(int argc, char* argv[])
       +{
       +    using std::cout;
       +
       +    unsigned int N, i, j;
       +
       +    if (argc == 2) {
       +        N = atoi(argv[1]);
       +    } else {
       +        std::cerr << "Sorry, I need matrix width as command line argument\n";
       +        return 1;
       +    }
       +
       +    arma::mat A(N,N);
       +    arma::mat B(N,N);
       +    arma::mat C(N,N);
       +
       +    for (i = 0; i<N; ++i) {
       +        for (j = 0; j<N; ++j) {
       +            A(i,j) = 2.0;
       +            B(i,j) = (double) N*j + i;
       +        }
       +    }
       +
       +    C = A*B;
       +
       +    return 0;
       +}
 (DIR) diff --git a/matrixmul/cpp-eigen.cpp b/matrixmul/cpp-eigen.cpp
       t@@ -0,0 +1,33 @@
       +#include <iostream>
       +#include <cstdlib>
       +#include <Eigen/Dense>
       +
       +int main(int argc, char* argv[])
       +{
       +    using std::cout;
       +    using Eigen::MatrixXd;
       +
       +    unsigned int N, i, j;
       +
       +    if (argc == 2) {
       +        N = atoi(argv[1]);
       +    } else {
       +        std::cerr << "Sorry, I need matrix width as command line argument\n";
       +        return 1;
       +    }
       +
       +    MatrixXd A(N,N);
       +    MatrixXd B(N,N);
       +    MatrixXd C(N,N);
       +
       +    for (i = 0; i<N; ++i) {
       +        for (j = 0; j<N; ++j) {
       +            A(i,j) = 2.0;
       +            B(i,j) = (double) N*j + i;
       +        }
       +    }
       +
       +    C = A*B;
       +
       +    return 0;
       +}
 (DIR) diff --git a/matrixmul/plot.gp b/matrixmul/plot.gp
       t@@ -21,4 +21,6 @@ plot \
                 "julia.dat" title "Julia" w lp, \
                 "c-gsl-cblas.dat" title "C: GSL CBLAS" w lp, \
                 "octave.dat" title "Octave" w lp
       +         "cpp-armadillo.dat" title "C++: Armadillo" w lp, \
       +         "cpp-eigen.dat" title "C++: Eigen3" w lp, \