Boost logo

Ublas :

From: Ian Fellows (ifellows_at_[hidden])
Date: 2007-10-05 17:23:19


Hi All,

I'm having some trouble using the ublas bindings. Please forgive my
ignorance, I have not found any step-by-step documentation.

So I downloaded the bindings from:
http://news.tiker.net/software/boost-bindings

In cygwin, I copied the bindings into the numeric folder, and copied
'configure' and 'makefile.in' to C:\Program Files\boost\boost_1_34_0
directory and entered:
./configure
make --debug

It makes fine, but notes that:
File 'all' does not exist.
Must remake target 'all'.

I definitely am doing something wrong, as I get as error ("failed to
specialize function template 'matrix_traits<M>::pointer") when I call the
bindings. I have MKL installed/linked properly, and have been working with
uBlas for a while. I'm sorry to bother everyone with such a basic question,
but I'm unsure of how to proceed.

Thanks in advance,
Ian

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <math.h>
//#include "mkl_blas.h"
#include <boost\numeric\bindings\blas\blas.hpp>
namespace mkl_blas = boost::numeric::bindings::blas;

using namespace boost::numeric::ublas;
int main (int argc, char * const argv[])
{
        matrix<float> a(3,3);
        matrix<float> b(3,3);
        matrix<float> c(3,3);
        float beta=0.0;
        float alpha = 1.0;
        for(int i =0;i<3;i++)
        {
                for(int j = 0;j<3;j++)
                {
                        a(i,j)=(float) i + (float) j;
                        b(i,j)=(float) i * (float) j;
                        c(i,j)=0.0;
                }
        }
          // C <- alpha * A * B + beta * C
        mkl_blas::gemm(alpha,a,b,beta,c);
        std::cout<<c;

        return 0;
}
1>------ Build started: Project: CPokerProject, Configuration: Debug
Win32 ------
1>Compiling...
1>main.cpp
1>C:\Program
Files\boost\boost_1_34_0\boost/numeric/bindings/blas/blas3.hpp(38) : error
C2893: Failed to specialize function template 'matrix_traits<M>::pointer
boost::numeric::bindings::traits::matrix_storage(M &)'
1> With the following template arguments:
1> 'const boost::numeric::ublas::matrix<T>'
1> with
1> [
1> T=float
1> ]
1> C:\Program
Files\boost\boost_1_34_0\boost/numeric/bindings/blas/blas3.hpp(55) : see
reference to function template instantiation 'void
boost::numeric::bindings::blas::gemm<value_type,matrix_type_a,matrix_type_b,
matrix_type_c>(const char,const char,const value_type &,const matrix_type_a
&,const matrix_type_b &,const value_type &,matrix_type_c &)' being compiled
1> with
1> [
1> value_type=float,
1> matrix_type_a=boost::numeric::ublas::matrix<float>,
1> matrix_type_b=boost::numeric::ublas::matrix<float>,
1> matrix_type_c=boost::numeric::ublas::matrix<float>
1> ]
1> ..\..\CPokerProject 052907 flop to river\CPokerProject
052507\main.cpp(108) : see reference to function template instantiation
'void
boost::numeric::bindings::blas::gemm<float,boost::numeric::ublas::matrix<T>,
boost::numeric::ublas::matrix<T>,boost::numeric::ublas::matrix<T>>(const
value_type &,const matrix_type_a &,const matrix_type_b &,const value_type
&,matrix_type_c &)' being compiled
1> with
1> [
1> T=float,
1> value_type=float,
1> matrix_type_a=boost::numeric::ublas::matrix<float>,
1> matrix_type_b=boost::numeric::ublas::matrix<float>,
1> matrix_type_c=boost::numeric::ublas::matrix<float>
1> ]
1>C:\Program
Files\boost\boost_1_34_0\boost/numeric/bindings/blas/blas3.hpp(39) : error
C2893: Failed to specialize function template 'matrix_traits<M>::pointer
boost::numeric::bindings::traits::matrix_storage(M &)'
1> With the following template arguments:
1> 'const boost::numeric::ublas::matrix<T>'
1> with
1> [
1> T=float
1> ]
1>C:\Program
Files\boost\boost_1_34_0\boost/numeric/bindings/blas/blas3.hpp(40) : error
C2893: Failed to specialize function template 'matrix_traits<M>::pointer
boost::numeric::bindings::traits::matrix_storage(M &)'
1> With the following template arguments:
1> 'boost::numeric::ublas::matrix<T>'
1> with
1> [
1> T=float
1> ]

1>CPokerProject - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========