Dear All,

I am a new user to the boost library. Actually, part of the algorithm I am developing needs efficient matrix-matrix multiplication. I have tried various libraries including (GMM++, VNL, gsl) and unfortunately non of them performed well comparing to MATLAB. To measure efficiency, I perform a simple matrix-matrix product.  I read in the following thread that if one uses atlas instead of blas for dense matrices, she gets order of magniture boost in the performance:

http://lists.boost.org/MailArchives/ublas/2007/03/1963.php

So here is my question:

- I am a Linux user (Ubuntu 8.10, 64bit, gcc 4.3.2, 4Gig RAM) and I have isntalled boost using repository. It seems that atals is not officially part of the boost (pleas correct me if I am wrong)? Could anybody kindly tell how I can install it? I know that I should find in the sandbox but I could find any instruction or step through.

- My program involves multiplication of very tall matrix by almost square matrix (1000000x 30  by 30 x 30). I have performed this multiplication using gsl and it produced the result after 4.1second. Similar operation, using ublas took about 37second! Similar operation takes about 0.5second in MATLAB. I presume that there is a blunder in my program but I cannot figure it out:


#include <iostream>


#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/timer.hpp>


# include <sys/time.h>

namespace ublas = boost::numeric::ublas;
using namespace std;


double gettime() {
    struct timeval t;
    gettimeofday(&t, NULL);
    return (double)t.tv_sec+t..tv_usec*0.000001;
}

void initmatrix(ublas::matrix<double>& A) {
 for(size_t i = 0; i<A.size1(); i++)
  for(size_t j = 0; j<A.size2(); j++)
   A(i,j) = 1.0*rand();
}
void initmatrix(ublas::matrix<double,ublas::column_major>& A) {
 for(size_t i = 0; i<A.size1(); i++)
  for(size_t j = 0; j<A.size2(); j++)
   A(i,j) = 1.0*rand();
}


int main(int argc, char *argv[])
{
    long int D,r,n ;

    //std::clock_t start;
    //double diff;
    double t1,t2 ;


    //D = 1000 ;
    D = atoi(argv[1]) ;
    //r = 1000 ;
    r = atoi(argv[2]) ;
    //n = 1000 ;
    n = atoi(argv[3]) ;

   {
   cout << "ublas  ";

   ublas::matrix<double> A(D,r);
   ublas::matrix<double,ublas::column_major> B(r,n);
   ublas::matrix<double> X(D,n);
   initmatrix(A);
   initmatrix(B);

   cout << "default implementation in blas" << endl ;
   t1 = gettime() ;
   X = ublas::prod(A,B) ;
   t2 = gettime() ;
   cout << "Time : " <<  t2 - t1 << endl;

   cout << "implementation using atlas" << endl  ;
   }

}


I reas some where that if I replace multiplication line with:
   X = ublas::prod< ublas::matrix<double> >(A,B);

but I get the following error when I do that:

test1.cpp: In function ‘int main(int, char**)’:
test1.cpp:64: error: call of overloaded ‘prod(boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_row_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >&, boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_column_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >&)’ is ambiguous
/usr/include/boost/numeric/ublas/matrix_expression.hpp:4810: note: candidates are: typename boost::numeric::ublas::matrix_matrix_binary_traits<typename E1::value_type, E1, typename E2::value_type, E2>::result_type boost::numeric::ublas::prod(const boost::numeric::ublas::matrix_expression<E>&, const boost::numeric::ublas::matrix_expression<E2>&) [with E1 = boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_row_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, E2 = boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_column_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >]
/usr/include/boost/numeric/ublas/matrix_expression.hpp:4869: note:                 M boost::numeric::ublas::prod(const boost::numeric::ublas::matrix_expression<E2>&, const boost::numeric::ublas::matrix_expression<E2>&) [with M = boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_row_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, E1 = boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_row_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, E2 = boost::numeric::ublas::matrix<double, boost::numeric::ublas::basic_column_major<long unsigned int, long int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >]


I would be thankfil if any person can help,

Regards,
Kaveh