Boost logo

Ublas :

From: pinacle (pinacle2000_at_[hidden])
Date: 2006-12-07 22:42:29


Thanks Fres and Gunter. This is exactly what I want. But the code listed
below gives me an error on the "project" line due to the ambiguous
overloading as:

1>.\test.cxx(44) : error C2665: 'boost::numeric::ublas::project' : none of
the 4 overloads could convert all the argument types
1> D:\boost\boost/numeric/ublas/vector_proxy.hpp(492): could be
'boost::numeric::ublas::vector_range<V>
boost::numeric::ublas::project<boost::numeric::ublas::vector<T>>(V &,const
boost::numeric::ublas::basic_range<> &)'
1> with
1> [
1> V=boost::numeric::ublas::vector<double>,
1> T=double
1> ]
1> D:\boost\boost/numeric/ublas/vector_proxy.hpp(497): or 'const
boost::numeric::ublas::vector_range<V>
boost::numeric::ublas::project<boost::numeric::ublas::vector<T>>(const
boost::numeric::ublas::vector<T> &,const
boost::numeric::ublas::basic_range<> &)'
1> with
1> [
1> V=const boost::numeric::ublas::vector<double>,
1> T=double
1> ]
1> D:\boost\boost/numeric/ublas/vector_proxy.hpp(990): or
'boost::numeric::ublas::vector_slice<V>
boost::numeric::ublas::project<boost::numeric::ublas::vector<T>>(V &,const
boost::numeric::ublas::basic_slice<> &)'
1> with
1> [
1> V=boost::numeric::ublas::vector<double>,
1> T=double
1> ]
1> D:\boost\boost/numeric/ublas/vector_proxy.hpp(995): or 'const
boost::numeric::ublas::vector_slice<V>
boost::numeric::ublas::project<boost::numeric::ublas::vector<T>>(const
boost::numeric::ublas::vector<T> &,const
boost::numeric::ublas::basic_slice<> &)'
1> with
1> [
1> V=const boost::numeric::ublas::vector<double>,
1> T=double
1> ]
1> while trying to match the argument list
'(boost::numeric::ublas::vector<T>, boost::numeric::ublas::vector<T>)'
1> with
1> [
1> T=double
1> ]
1> and
1> [
1> T=size_t
1> ]

Could you please point out how to solve this problem?

Best,
Feng

-----Original Message-----
From: ublas-bounces_at_[hidden] [mailto:ublas-bounces_at_[hidden]]
On Behalf Of Gunter Winkler
Sent: Thursday, December 07, 2006 3:09 AM
To: ublas mailing list
Subject: Re: [ublas] prod using part of matrix

On Thursday 07 December 2006 10:55, Kresimir Fresl wrote:

> > No, this is not implemented yet, but we are looking for someone who
> > does the job.

Someone already did the job.

> Aren't classes vector_indirect<> and matrix_indirect<> (in
> vector_proxy.hpp and matrix_proxy.hpp) what pinacle is looking for?

    // Vector based indirection class
    // Contributed by Toon Knapen.
    // Extended and optimized by Kresimir Fresl.

You should know better ;-) . I never noticed their existence...

ok. I suggest to try this:

ublas::vector<size_t> index_list(3);
index_list = scalar_vector<size_t>(5,1); ublas::vector<double> vec(1);
vec(0) = 2.0;
ublas::vector<double> x(3);

x = project(vec, index_list);

(x should be (2.0, 2.0, 2.0) )

mfg
Gunter