Subject: [Boost-bugs] [Boost C++ Libraries] #9150: multiprecision::cpp_rational doesn't work with element_prod of boost::numeric::ublas
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-23 04:46:27
#9150: multiprecision::cpp_rational doesn't work with element_prod of
boost::numeric::ublas
------------------------------+----------------------------
Reporter: yaoyuan1216@⦠| Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
Version: Boost 1.54.0 | Severity: Problem
Keywords: rational vector |
------------------------------+----------------------------
Consider
{{{
#include<boost/numeric/ublas/vector.hpp>
#include<boost/numeric/ublas/io.hpp>
#include<boost/multiprecision/cpp_int.hpp>
#include<complex>
int main(){
typedef boost::multiprecision::cpp_rational Type;
boost::numeric::ublas::vector<Type> a(3, 1), b(3);
b(0) = 0;
b(1) = Type(-3, 4);
b(2) = 2;
std::cout<<"a = "<<a<<", b = "<<b;
noalias(a) = element_prod(a, b);
std::cout<<", a*b = "<<a<<"\n";
return 0;
}
}}}
The output is:[[BR]]
a = [3](1,1,1), b = [3](0,-3/4,2), a*b = [3](0,1,1)[[BR]]
[[BR]]
The same problem exists with mpq_rational.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9150> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC