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? Can I cast vectors and matrices from int to double easily? ...define some matrix <int>m... boost::numeric::ublas::vector<int> v = row(m, 1); int s = norm_inf(v); The complaint is as follows: /tmp/ccA7KBD2.o: In function `boost::numeric::ublas::type_traits<int>::norm_inf(int const &)': /tmp/ccA7KBD2.o (.boost::numeric::ublas::type_traits<int>::gnu.linkonce.t.norm_inf (int const &)+0x12): undefined reference to `boost::numeric::ublas::type_traits<int>::imag(int const &)' /tmp/ccA7KBD2.o (.boost::numeric::ublas::type_traits<int>::gnu.linkonce.t.norm_inf (int const &)+0x21): undefined reference to `boost::numeric::ublas::type_traits<int>::abs(int const &)' /tmp/ccA7KBD2.o (.boost::numeric::ublas::type_traits<int>::gnu.linkonce.t.norm_inf (int const &)+0x31): undefined reference to `boost::numeric::ublas::type_traits<int>::real(int const &)' /tmp/ccA7KBD2.o (.boost::numeric::ublas::type_traits<int>::gnu.linkonce.t.norm_inf (int const &)+0x40): undefined reference to `boost::numeric::ublas::type_traits<int>::abs(int const &)' collect2: ld returned 1 exit status Thanks, Julian
----- Original Message ----- From: cerenoc To: Boost-Users@yahoogroups.com 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
participants (2)
-
cerenoc
-
jhr.walter@t-online.de