Boost logo

Boost Users :

Subject: [Boost-users] [uBLAS] Initialize a matrix by T*?
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-05-10 04:37:04


Hi,
I'm new to uBLAS.
I wonder if there is an efficient way to initialize a ublas::matrix<T> by a T*.
Somthing like a copy(matrix<T>& m, T* p, size_t nrows, size_t ncols).
For instance:

--- [code_snip] ---
double* pd = new double[10*20];
//...
ublas::matrix<double> m;
copy(m, pd, 10, 20);
--- [/code_snip] ---
Obviously I can create a 10x20 empty matrix (matrix<T> m(10,20)) and
then scan the T* assigning each element one at time.

But is there a more efficient way?

Thank you very much in advance!!

-- Marco


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