Boost logo

Ublas :

From: Guimond, Alexandre (alexandre.guimond_at_[hidden])
Date: 2006-09-07 08:03:46


Hi.
 
i'm trying to construct a vector from a regular c array pointer
containing the data. I would also like the c array to be used for the
vector operations as opposed to the data being copied to the vector so
that any operation on the data is reflected on the c array. basically, i
would like to wrap my buffers in vectors. for example
 
float array[10];
for( int i =0; i < 10; ++i )
{
    array[ i ] = i;
}
 
ublas::vector< float >( 10, array ) vec;
vec *= 2.0f;
<at this point, i would like array = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18
}
vec = ( vec + 2 ) / 2
<at this point, i would like array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
 
I'm would think there is a way to do this, but I cannot find it. could
somebody provide pointers?
 
thx for any help
 
alex