|
Boost Users : |
From: jhr.walter_at_[hidden]
Date: 2003-06-05 03:52:02
----- Original Message -----
From: cerenoc
To: Boost-Users_at_[hidden]
Sent: Thursday, June 05, 2003 7:50 AM
Subject: [Boost-Users] norm_inf type-related error
> Can somebody help me with this? The following simple piece of code
> compiles fine if m, v, and s are declared as type <double> but not
> for type <int> as shown. Why is that?
Mathematically speaking, integers usually don't fulfill the requirements for
the field of a vector space.
> Can I cast vectors and
> matrices from int to double easily?
Copy yes, cast no. In your case something like
> ...define some matrix <int>m...
> boost::numeric::ublas::vector<int> v = row(m, 1);
> int s = norm_inf(v);
double d = norm_inf (boost::numeric::ublas::vector<double>(v));
should work.
> The complaint is as follows:
>
> /tmp/ccA7KBD2.o: In function
> `boost::numeric::ublas::type_traits<int>::norm_inf(int const &)':
[snip more unresolved references]
This is a bug, which is fixed in CVS. You now should get a runtime error
then (oops: I just realized that it probably would be better to generate a
compile time error ;-(
Thanks for your feedback,
Joerg
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