From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-02-04 17:32:55
> Hi, I'm a new Ublas user.
> I wish to do the following thing: I want to create a new matrix specifying its
> size (m rows, n columns) and a pointer to the data contained in the matrix.
> These data naturally fit the UBLAS storage. It is maybe a little bit strange
> but I necessary need this functionality.
> I explain why...
> In fact I implement a program in which two processes run in parallel (thanks
> to pthreads,shared memory or MPI). It exists some common interface between
> the two processes. In the first process a UBLAS matrix is created and
> assigned, the interface is created and it contains the matrix data. The other
> process knows the size of the matrix but I really don't wish to copy the data
> of the interface in a new matrix. The size of the interface is really big and
> the update of the quantities at the interface occurs very often.
> I assume it exists in the vector/matrix class a pointer to the data. If yes
> what? May I to assigned it? Or is it protected???
> How have I to do?
The answer is to use array adaptors. (Look for 'array adaptor' in the
archive). If you only need read only access, you can use my read only
uBlas additionally supports carray_adaptor and shallow_array_adaptor.
However, I suggest to read the comments in storage.hpp and on this list
before you try to modify matrices based on adaptors.