tcpp-armadillo.cpp - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tcpp-armadillo.cpp (548B)
       ---
            1 #include <iostream>
            2 #include <cstdlib>
            3 #include <armadillo>
            4 
            5 int main(int argc, char* argv[])
            6 {
            7     using std::cout;
            8 
            9     unsigned int N, i, j;
           10 
           11     if (argc == 2) {
           12         N = atoi(argv[1]);
           13     } else {
           14         std::cerr << "Sorry, I need matrix width as command line argument\n";
           15         return 1;
           16     }
           17 
           18     arma::mat A(N,N);
           19     arma::mat B(N,N);
           20     arma::mat C(N,N);
           21 
           22     for (i = 0; i<N; ++i) {
           23         for (j = 0; j<N; ++j) {
           24             A(i,j) = 2.0;
           25             B(i,j) = (double) N*j + i;
           26         }
           27     }
           28 
           29     C = A*B;
           30 
           31     return 0;
           32 }