Boost logo

Ublas :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-01-18 13:07:38


Hmm. ublas::vector<double*> didn¹t work

Here is a brief example of what I am trying to accomplish:

  double u[10];
  for(int i=0; i<10; ++i){
    u[i]=2*i;
  }
  typedef boost::numeric::ublas::vector<double*> Vec;
  Vec uvec(10,&u);
  uvec(2) = 10;
  assert( uvec(2)==u[2] );

In other words, I want to manage the memory externally but use ublas to
³view² the memory as a ublas vector that I can use with ublas matrices,
other vectors, etc. I must avoid memory copies for efficiency reasons.

James