|
Ublas : |
From: Tsai Dung-Bang (dbtsai_at_[hidden])
Date: 2007-11-24 17:01:29
Dear all
I would like to test other floating type rather than double in the
template, so I simply changed typedef double DP in sample.cpp into
typedef float DP, but the program could not compile now.
It seems that it's a type promotion error?
The error message is the following. Thanks, and forgive my troubling.
dbtsai_at_macbook:~/qis_code/my_code/GRAPE/expokit/c$ make
g++ -O3 -o sample sample.cpp
/usr/include/boost/numeric/ublas/traits.hpp: In instantiation of
'const size_t boost::numeric::ublas::promote_traits<double,
std::complex<float> >::size':
/usr/include/boost/numeric/ublas/traits.hpp:43: instantiated from
'const size_t boost::numeric::ublas::promote_traits<double,
std::complex<float> >::index'
/usr/include/boost/numeric/ublas/traits.hpp:45: instantiated from
'boost::numeric::ublas::promote_traits<double, std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:128: instantiated
from 'boost::numeric::ublas::scalar_binary_functor<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:157: instantiated
from 'boost::numeric::ublas::scalar_multiplies<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/matrix_expression.hpp:2541:
instantiated from 'boost::numeric::ublas::matrix_binary_scalar1<const
double, boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >,
boost::numeric::ublas::scalar_multiplies<double, std::complex<float> >
>'
expm.hpp:122: instantiated from 'MATRIX
boost::numeric::ublas::expm_pad(const MATRIX&, typename
boost::numeric::ublas::type_traits<typename T::value_type>::real_type,
int) [with MATRIX = boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >]'
sample.cpp:27: instantiated from here
/usr/include/boost/numeric/ublas/traits.hpp:41: error: no match for
'operator+' in 'boost::numeric::ublas::promote_traits<double,
std::complex<float> >::x +
boost::numeric::ublas::promote_traits<double, std::complex<float>
>::y'
/usr/include/c++/4.2/bits/stl_bvector.h:353: note: candidates are:
std::_Bit_const_iterator std::operator+(ptrdiff_t, const
std::_Bit_const_iterator&)
/usr/include/c++/4.2/bits/stl_bvector.h:267: note:
std::_Bit_iterator std::operator+(ptrdiff_t, const
std::_Bit_iterator&)
/usr/include/boost/numeric/ublas/traits.hpp: In instantiation of
'const size_t boost::numeric::ublas::promote_traits<double,
std::complex<float> >::index':
/usr/include/boost/numeric/ublas/traits.hpp:45: instantiated from
'boost::numeric::ublas::promote_traits<double, std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:128: instantiated
from 'boost::numeric::ublas::scalar_binary_functor<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:157: instantiated
from 'boost::numeric::ublas::scalar_multiplies<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/matrix_expression.hpp:2541:
instantiated from 'boost::numeric::ublas::matrix_binary_scalar1<const
double, boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >,
boost::numeric::ublas::scalar_multiplies<double, std::complex<float> >
>'
expm.hpp:122: instantiated from 'MATRIX
boost::numeric::ublas::expm_pad(const MATRIX&, typename
boost::numeric::ublas::type_traits<typename T::value_type>::real_type,
int) [with MATRIX = boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >]'
sample.cpp:27: instantiated from here
/usr/include/boost/numeric/ublas/traits.hpp:43: error:
'boost::numeric::ublas::promote_traits<double, std::complex<float>
>::index' cannot be initialized by a non-constant expression when
being declared
/usr/include/boost/numeric/ublas/traits.hpp: In instantiation of
'boost::numeric::ublas::promote_traits<double, std::complex<float> >':
/usr/include/boost/numeric/ublas/functional.hpp:128: instantiated
from 'boost::numeric::ublas::scalar_binary_functor<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:157: instantiated
from 'boost::numeric::ublas::scalar_multiplies<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/matrix_expression.hpp:2541:
instantiated from 'boost::numeric::ublas::matrix_binary_scalar1<const
double, boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >,
boost::numeric::ublas::scalar_multiplies<double, std::complex<float> >
>'
expm.hpp:122: instantiated from 'MATRIX
boost::numeric::ublas::expm_pad(const MATRIX&, typename
boost::numeric::ublas::type_traits<typename T::value_type>::real_type,
int) [with MATRIX = boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >]'
sample.cpp:27: instantiated from here
/usr/include/boost/numeric/ublas/traits.hpp:45: error: '(((long
unsigned int)boost::numeric::ublas::promote_traits<double,
std::complex<float> >::size) - 1ul)' is not a valid template argument
for type 'long int' because it is a non-constant expression
/usr/include/boost/numeric/ublas/traits.hpp: In instantiation of
'boost::numeric::ublas::promote_traits<double, std::complex<float> >':
/usr/include/boost/numeric/ublas/functional.hpp:128: instantiated
from 'boost::numeric::ublas::scalar_binary_functor<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/functional.hpp:157: instantiated
from 'boost::numeric::ublas::scalar_multiplies<double,
std::complex<float> >'
/usr/include/boost/numeric/ublas/matrix_expression.hpp:2541:
instantiated from 'boost::numeric::ublas::matrix_binary_scalar1<const
double, boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >,
boost::numeric::ublas::scalar_multiplies<double, std::complex<float> >
>'
expm.hpp:122: instantiated from 'MATRIX
boost::numeric::ublas::expm_pad(const MATRIX&, typename
boost::numeric::ublas::type_traits<typename T::value_type>::real_type,
int) [with MATRIX = boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >]'
sample.cpp:27: instantiated from here
/usr/include/boost/numeric/ublas/traits.hpp:46: error: '(((long
unsigned int)boost::numeric::ublas::promote_traits<double,
std::complex<float> >::size) - 1ul)' is not a valid template argument
for type 'long int' because it is a non-constant expression
expm.hpp: In function 'MATRIX boost::numeric::ublas::expm_pad(const
MATRIX&, typename boost::numeric::ublas::type_traits<typename
T::value_type>::real_type, int) [with MATRIX =
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >]':
sample.cpp:27: instantiated from here
expm.hpp:122: error: no match for 'operator+' in 'I +
boost::numeric::ublas::operator*(const T1&, const
boost::numeric::ublas::matrix_expression<E2>&) [with T1 = double, E2 =
boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >](((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > > >&)((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > > >*)(&
boost::numeric::ublas::prod(const
boost::numeric::ublas::matrix_expression<E>&, const
boost::numeric::ublas::matrix_expression<E2>&) [with E1 =
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >, E2 =
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >](((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > > >&)((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > > >*)(& P))))))))'
/usr/include/c++/4.2/bits/stl_bvector.h:353: note: candidates are:
std::_Bit_const_iterator std::operator+(ptrdiff_t, const
std::_Bit_const_iterator&)
/usr/include/c++/4.2/bits/stl_bvector.h:267: note:
std::_Bit_iterator std::operator+(ptrdiff_t, const
std::_Bit_iterator&)
sample.cpp:27: instantiated from here
expm.hpp:122: error: no match for 'operator+' in 'I +
boost::numeric::ublas::operator*(const T1&, const
boost::numeric::ublas::matrix_expression<E2>&) [with T1 = double, E2 =
boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > >](((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > > >&)((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >,
boost::numeric::ublas::matrix_matrix_prod<std::complex<float>,
std::complex<float>, std::complex<float> > > >*)(&
boost::numeric::ublas::prod(const
boost::numeric::ublas::matrix_expression<E>&, const
boost::numeric::ublas::matrix_expression<E2>&) [with E1 =
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >, E2 =
boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > >](((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > > >&)((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<std::complex<float>,
boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<float>,
std::allocator<std::complex<float> > > > >*)(& P))))))))'
/usr/include/c++/4.2/bits/stl_bvector.h:353: note: candidates are:
std::_Bit_const_iterator std::operator+(ptrdiff_t, const
std::_Bit_const_iterator&)
/usr/include/c++/4.2/bits/stl_bvector.h:267: note:
std::_Bit_iterator std::operator+(ptrdiff_t, const
std::_Bit_iterator&)
make: *** [sample] Error 1
-- Best Wishes, Tsai, Dung-Bang è¡æ±é¦ ----------------------------------- Department of Physics National Taiwan University No. 1, Sec. 4, Roosevelt Road Taipei 10617, Taiwan TEL: +886-2-3366-5134