Boost logo

Ublas :

From: Ryan Budney (rybu_at_[hidden])
Date: 2007-11-26 19:51:31

Hello ublas users,

I'm hoping you might have an answer to a question. I'm just getting to
know ublas, attempting to see if it can do what I'm hoping it can do.
Here is a simple piece of code that is giving me problems:

* * *
boost::numeric::ublas::compressed_vector<regina::NLargeInteger> vec1(100);
boost::numeric::ublas::coordinate_vector<regina::NLargeInteger> vec2;
* * *

regina::NLargeInteger is a class that represents arbitrary-precision
integers, see:
for details. It's just a class container for the GNU GMP library.

On attempting to compile, I get the error message:

/usr/include/boost/numeric/ublas/traits.hpp:89: error: no matching
function for call to ‘abs(const regina::NRational&)’
/usr/include/stdlib.h:784: note: candidates are: int abs(int)
/usr/include/c++/4.1.3/cstdlib:142: note: long int
std::abs(long int)
/usr/include/c++/4.1.3/cstdlib:172: note: long long int
__gnu_cxx::abs(long long int)
/usr/include/c++/4.1.3/cmath:89: note: double
/usr/include/c++/4.1.3/cmath:93: note: float std::abs(float)
/usr/include/c++/4.1.3/cmath:97: note: long double
std::abs(long double)

it also complains about the lack of a sqrt() function for NLargeInteger.

Does this mean ublas is set up only for matrices and vectors of type
"double" or "float"? It seems confusing to me -- the documentation that
I've been able to find on-line has no mention of this, at least, none that
I can find.

Basically, I've been looking to implement Laurent polynomials over
arbitrary template classes that behave like rings, and the corresponding
linear algebra. Mainly I want a templated linear algebra package that
works over the integers (of a variety of flavours, especially arbitrary
precision), and Laurent polynomial rings.

Thanks for any advice.

-Ryan Budney