We are using Lapack++ for our matrix calculations. One of the features is the use of submatrixviews; objects that refer to the same spot in memory.
Example:
LaGenMatDouble W = LaGenMatDouble::rand(3,4);
LaGenMatDouble A = W(LaIndex(0,2), LaIndex(1,3));
LaGenMatDouble b = W(LaIndex(0,2), LaIndex(0,0));
A and b are now submatrices of W.
How can I make b a LaVectorDouble to be able to perform some calculations with it?
The answer is to use the ref function.
LaVectorDouble b;
b.ref(W(LaIndex(0,2), LaIndex(0,0)));
All other functions are copying (like constructor, = and copy) or giving the wrong class (like the constructor with indices). The ref function is referencing to memory.