On Thu, Nov 28, 2002 at 09:12:53AM -0500, Toon Knapen wrote:
On Wednesday 27 November 2002 20:46, Stephen Crowley wrote:
What do you mean by "just use it as" ?
For example.. I have a matrix<double> m(5,5);
In some code I actually need to use it as a 5x5 matrix.. but other
must reference it as a vector (to pass to another library).
OK, So as to get to the bottom of this. Do you really want to perform vector operations on a vector that consists of a concatenation of all rows (or columns) of the matrix do you want to get access to the storage to pass your information to another library.
The latter case is dealt with in the boost-sandbox/boost/numeric/bindings. There we've spend effort to be able to extract the begin- and end-pointer (not iterator) from any vector or matrix. (In the bindings it's used to
Stephen Crowley wrote: parts pass
these pointers to e.g. BLAS)
In the former case, could you enlighten me what kind of numeric operations you're dealing with ?
The matrix I am working with is a set of weights for a neural net. I am using a kalman filtering library (http://www.acfr.usyd.edu.au/technology/bayesianfilter/Bayes++.htm) that treats the weights as a vector.
This looks more like a conceptual than an integration problem. Maybe Bayes++ should support a corresponding matrix signature, too? OTOH it seems valid to look at the vector space of linear operators. If this is a recurring use case, we should consider to add new proxy classes matrix_as_vector<> (and vector_as_matrix<>) to uBLAS.
So, I'm not really sure how to answer your question. I guess I would say that I need to access a vector as a concatenation of the rows or columns of the matirx (for this purpose it does not matter as long as it is consistent). However, copying undering data() member is working for now, although not as quickly as I would like.
I'm not sure if this (or array_adaptor) should be the final solution. Regards Joerg