Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9150 closed Bugs (worksforme)

multiprecision doesn't work with element_prod of boost::numeric::ublas

Reported by: yaoyuan1216@… Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.53.0 Severity: Problem
Keywords: rational vector Cc: gcc, 4.7.3

Description

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:
a = [3](1,1,1), b = [3](0,-3/4,2), a*b = [3](0,1,1)

The same problem exists with mpq_rational.

Change History (4)

comment:1 by anonymous, 9 years ago

Summary: multiprecision::cpp_rational doesn't work with element_prod of boost::numeric::ublasmultiprecision doesn't work with element_prod of boost::numeric::ublas

comment:2 by anonymous, 9 years ago

The same problem exists for all number<type>.

comment:3 by John Maddock, 9 years ago

Resolution: worksforme
Status: newclosed

This works for me for 1.54.0 onwards, can only reproduce in 1.53.0. Can you make doubly sure you're using the latest Boost version?

comment:4 by anonymous, 9 years ago

Version: Boost 1.54.0Boost 1.53.0
Note: See TracTickets for help on using tickets.