Am 29.11.2011 um 19:25 schrieb Thomas Klimpel:

Kraus Philipp wrote:
The C++ Code ist build with 
g++ text.cpp -I/Developer/opt/Boost/1.48.0/include -I/Developer/opt/Boost/sandbox/numeric_bindings -latlas -lf77blas -lcblas

Matlab result: 1.897052466920491
C++ result: blas: 1.46849
    ublas: 1.46849

I tried to reproduce (I even installed boost-1.48), but I got
ublas:  1.89705

mmmh, that's bad. I'm using boost 1.48 also. Should I downgrade my Boost version (I have installed the 1.47)?


Can you remove the call to "blas::nrm2(vec3)" or at least call "ublas::norm_2(vec3)" first, so that "memory corruption" by "blas::nrm2(vec3)" can be excluded?


If I compile it with -D BOOST_NUMERIC_BINDINGS_BLAS_CBLAS flag, I get errors eg:

You need to add the include path for atlas to the compile line...


Yes, I've forgot ist. But with the CBLAS flag the result ist also 1.46849



The parameter n is the vector.size(), x the vector, isn't it?

Correct.

Which definition has incx?

You should set it to "1" for this case.


I have add the line std::cout << "cblas:\t" << cblas_dnrm2( vec3.size(), &vec3(0), 1 ) << std::endl; 
to my example. All values are 1.46849 again.

I have updated the bindings to 75728

I am a little perplexed

Phil