Boost logo

Boost Users :

Subject: [Boost-users] Bug in Ublas' Inner Product between Matrix and Vector?
From: Gundala Viswanath (gundalav_at_[hidden])
Date: 2009-01-29 22:17:45


Hi all,

I am trying to perform an inner product multiplication
with ublas between this Matrix and Vector:

ublas::matrix <double> inputMat (5,5,0);
[5,5]((0.994704,0.000882587,0.000882587,0.000882587,0.00264776),(0.00527045,0.989459,0.00263523,0.00263523,0),(0,0,0.00528298,0,0),(0,0,0,1,0),(0,0,0,0,1))

ublas::vector <double> inputVec (5);
[5](0.4,0.2,0.2,0.2,0.2)

The result I get is this:
[5](0.398941,0.201054,0.0010566*,0.2,0.2)

Where as the correct one should be (using R):
0.3999707,0.1981258,0.2007013*,0.2007013,0.2005310

Note the significant discrepancy in the 3rd element (*).

The product command I use is this:

ublas::vector <double> Result (5);
Result = ublas::prod(inputMat,inputVec);

Is there anything wrong with my way of doing inner product
or it is a bug?

- Gundala Viswanath
Jakarta - Indonesia


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