Boost logo

Boost Users :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2004-06-14 07:14:51


(cross-posting to ublas-dev)

Apparantly the problem is the promote_traits. E.g. following snippet
prints that the result of the promote_traits is a boost::mpl::void_.

<code>
#include <iostream>
#include <boost/numeric/ublas/vector.hpp>

namespace ublas = boost::numeric::ublas;

int main(int argc, char **argv)
{
   typedef ublas::promote_traits<short,double>::builtin_promote_type
result_type ;
   std::cout << typeid( result_type ).name() <<std::endl ;

   return 0;
}
</code>

kjfh kjnk wrote:

> Hi,
>
> This simple code creates 2 ublas vector and computes
> the inner_product. It does not compile with VC 7.1:
>
> ---------------------------------------------------
> #include <iostream>
> #include <string>
> #include <boost/concept_check.hpp>
> #include <boost/numeric/ublas/matrix.hpp>
>
> namespace ublas = boost::numeric::ublas;
>
> int main(int argc, char **argv)
> {
> ublas::vector<unsigned short> toto(3);
> ublas::vector<double> tata(3);
> double titi = ublas::inner_prod(toto, tata);
>
> return 0;
> }
> ---------------------------------------------------
>
> Here is the compilation:
>
> ***************************************************
> C:\Temp\ublas>cl -I"C:\Program Files\boost_1_31_0"
> /EHsc ublas-test.cpp
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
> 13.10.3052 for 80x86
> Copyright (C) Microsoft Corporation 1984-2002. All
> rights reserved.
>
> ublas-test.cpp
> ublas-test.cpp(12) : error C2440: 'initializing' :
> cannot convert from
> 'boost::numeric::ublas::vector_scalar_binary_traits<E1,E2,F>::result_type'
> to 'double'
> with
> [
> E1=boost::numeric::ublas::vector<unsigned
> short>,
> E2=boost::numeric::ublas::vector<double>,
>
> F=boost::numeric::ublas::vector_inner_prod<unsigned
> short,double,boost::mpl::if_c<false,unsigned
> short,boost::numeric::ublas::promote_traits<unsigned
> short,double>::builtin_promote_type>::type>
> ]
> No user-defined-conversion operator available
> that can perform this conversion, or the operator
> cannot be called
>
> C:\Temp\ublas>
> ****************************************************
>
> It compiles well with with VC 6.0, but the result is
> not good... (with a proper initialisation)
>
> Anybody has an idea ?
>
> JD
>
>
>
>
>
> ___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net