|
Boost : |
From: rwgk (rwgk_at_[hidden])
Date: 2002-03-09 12:07:41
--- In boost_at_y..., "jhrwalter" <walter_at_g...> wrote:
> Sure, IMO. One possibility is to use the array template
> argument of numerics::vector (or numerics::matrix ;-) to
> adapt your own storage container.
Thanks for the hint, this looks very interesting!
When I first looked at the ublas documentation I mistook
"A" for "allocator." Maybe you want to make this clearer,
e.g.
template <typename ElementType, typename ArrayType>
class vector ...
I was looking for information about the requirements for
"A" but could not find anything more than "The type of the
adapted array." Did I miss the relevant documentation?
Unfortunately I am having trouble compiling this minimal
example:
#include <vector>
#include <boost/numeric/ublas/config.h>
#include <boost/numeric/ublas/vector.h>
int main()
{
numerics::vector<float, std::vector<float> > ua(1000);
ua = ua * ua;
return 0;
}
Attached are the minimal patches that I applied to config.h
and iterator.h, and the output from two compilers.
Advice on how to fix the problems is very much appreciated.
Thanks,
Ralf
Index: config.h
===================================================================
RCS file: /cvsroot/boost/boost/boost/numeric/ublas/Attic/config.h,v
retrieving revision 1.1.2.8
diff -b -w -r1.1.2.8 config.h
108c108
< #ifdef USE_GCC
--- > #if defined(USE_GCC) || defined(__EDG__) // temp hack for EDG Index: iterator.h =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/Attic/iterator.h,v retrieving revision 1.1.2.8 diff -b -w -r1.1.2.8 iterator.h 519c519 < base () -= n; --- > this->base () -= n; 524c524 < base () += n; --- > this->base () += n; 543c543 < return base () (); --- > return this->base () (); 548c548 < return base ().index (); --- > return this->base ().index (); 575c575 < base () -= n; --- > this->base () -= n; 580c580 < base () += n; --- > this->base () += n; 599c599 < return base () (); --- > return this->base () (); 604c604 < return base ().index1 (); --- > return this->base ().index1 (); 608c608 < return base ().index2 (); --- > return this->base ().index2 (); 614c614 < return base ().begin (); --- > return this->base ().begin (); 618c618 < return base ().end (); --- > return this->base ().end (); 654c654 < base () -= n; --- > this->base () -= n; 659c659 < base () += n; --- > this->base () += n; 678c678 < return base () (); --- > return this->base () (); 683c683 < return base ().index1 (); --- > return this->base ().index1 (); 687c687 < return base ().index2 (); --- > return this->base ().index2 (); 693c693 < return base ().begin (); --- > return this->base ().begin (); 697c697 < return base ().end (); --- > return this->base ().end (); gcc 3.0.4 (RedHat 7.1): g++ -fPIC -ftemplate-depth-50 -DUSE_GCC -g - I"/net/cci/rwgk/boost" -c ublas_shared.cpp ublas_shared.cpp: In function `int main()': ublas_shared.cpp:8: ambiguous overload for `numerics::vector<float, std::vector<float, std::allocator<float> > >& * numerics::vector<float, std::vector<float, std::allocator<float> > >&' operator /net/cci/rwgk/boost/boost/numeric/ublas/vector_et.h:1331: candidates are: typename numerics::vector_binary_scalar2_traits<E1, T2, numerics::scalar_multiplies<typename E1::value_type, T2> >::result_type numerics::operator*(const numerics::vector_expression<E>&, const T2&) [with E1 = numerics::vector<float, std::vector<float, std::allocator<float> > >, T2 = numerics::vector<float, std::vector<float, std::allocator<float> > >] /net/cci/rwgk/boost/boost/numeric/ublas/vector_et.h:1113: typename numerics::vector_binary_scalar1_traits<T1, E2, numerics::scalar_multiplies<T1, typename E2::value_type> >::result_type numerics::operator*(const T1&, const numerics::vector_expression<E2>&) [with T1 = numerics::vector<float, std::vector<float, std::allocator<float> > >, E2 = numerics::vector<float, std::vector<float, std::allocator<float> > >] make: *** [ublas_shared.o] Error 1 Compaq cxx 6.2 (EDG240): Compaq cxx 6.5 (EDG245): cxx -I"/net/cci/rwgk/boost"/boost/compatibility/cpp_c_headers -std strict_ansi -msg_display_number -msg_disable 186,450,1115 -O2 - I"/net/cci/rwgk/boost" -c ublas_shared.cpp cxx: Error: ublas_shared.cpp, line 8: #350 more than one operator "*" matches these operands: function template "numerics::operator*(const T1 &, const numerics::vector_expression<E2> &)" function template "numerics::operator*(const numerics::vector_expression<E> &, const T2 &)" operand types are: numerics::vector<float, std::vector<float, std::allocator<float>>> * numerics::vector<float, std::vector<float, std::allocator<float>>> ua = ua * ua; ----------^ cxx: Info: 1 error detected in the compilation of "ublas_shared.cpp".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk