Login  Register

Re: How to copy a Boost::Matrix into a Quantlib::Matrix

Posted by Bojan Nikolic on Nov 08, 2011; 9:02am
URL: http://quantlib.414.s1.nabble.com/How-to-copy-a-Boost-Matrix-into-a-Quantlib-Matrix-tp12318p12319.html


Hi,

jrviala <[hidden email]> writes:

> I'm trying to use std::copy but it fails to compile
> It seems a rather simple problem I'm confident someone has used it somewhere
> could you tell me the correct wording?

Something like this should work:

 boost::numeric::ublas::matrix<double> m (3, 3);                                                                                                            
 QuantLib::Matrix mm(3,3);
 std::copy(m.begin1(), m.end1(), mm.begin());          

Although you need to check the column/row convention (I believe this
will transpose the matrix).

Best,
Bojan

--
Bojan Nikolic          ||          http://www.bnikolic.co.uk/ql

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev