|
Boost Users : |
Subject: [Boost-users] Fw: "newbie" Build Boost Matrix
From: Ismael Fadiga (ismaeltfadiga_at_[hidden])
Date: 2014-08-24 15:13:52
Hi
can anyone assist in building a matrix in Boost based on sql data queries? Actually:
matrix<double>pricemat(rowCount,colCount);for(unsignedi =0;i <pricemat.size1 ();++i)for(unsignedj =0;j <pricemat.size2 ();++j)pricemat (i,j)=cmd2[3].asDouble();std::cout <<pricemat <<std::endl;
prints a [221,3] , matching my expectations:
(rowCount =221&colCount=3)
However the elements of the matrix are not. Values from cmd2[3].asDouble() are not logically stored as matrix elements for (unsigned i = 0; i < pricemat.size1 (); ++ i) and for (unsigned j = 0; j < pricemat.size2 (); ++j) .
Main issue: since one cannot index cmd2[...].asDouble, the challenge consists of getting in the matrix columns/rows of
pricemat distinct cmd2[3].asDouble()values forj=0;j=1,andj=2andi=0to 220;
Hope the explanation is clear enough as this is a tricky case
On Sunday, 17 August 2014, 18:59, Ismael Fadiga <ismaeltfadiga_at_[hidden]> wrote:
hi all
After executing the below sql query in c++, the printed results are:
WITH rnum AS (SELECT s.ISN, s.Date, ClosedPrice, row_number() OVER (partition BY s.ISN ORDER BY s.ISN, s.Date DESC) AS rownumber FROM SecurityData s INNER JOIN PortfolioHoldings p ON s.ISN = p.ISN WHERE p.Pfid = 1876) SELECT DISTINCT ISN, Date, ClosedPrice FROM rnum WHERE rownumber <= 250))
//ID Date Price
US345 2014-08-17 342
US345 2014-08-16 310
...
FR123 2014-08-17 18.20
FR123 2014-08-16 15
Does anyone know how to build a price matrix for the IDs like:?
|342 18.20|
MAT=|310 15 |
|... ... |
Your feedback would be very appreciated
Cheers
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