Stephen Crowley wrote:
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 parts must reference it as a vector (to pass to another library).
Currently I am doing something like this
matrix<double> m(5,5); // do stuff to m vector<double> v(25); v.data() = m.data(); // pass v to library // get results back m.data() = v.data();
This is obviously not optimal.. and if both m.data() and v.data() pointed to the same location in memory the problem would be solved.
I suppose I might be able to get around it by making my own storage class that allows you to specify a location and size instead of allocating one itself.
There is a storage class `array_adaptor<>' (in storage.hpp, currently
undocumented), which adapts some other array to interface
which ublas classes expect:
==============================================
#include <cstddef>
#include <iostream>
#define BOOST_UBLAS_SIMPLE_ARRAY_ADAPTOR
#include