Boost logo

Ublas :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-01-18 14:10:33


Thanks for the suggestions.

The problem is that the containers seem to mandate STL-like semantics
(ublas::vector wants defined type information like A::size_type and
A::difference_type), which a raw pointer does not have. If you don't have a
container, just a pointer to memory (e.g. double*) then it is still not
clear to me how to get this to work.

My first try was:
 typedef ublas::vector<double,double*> Vec;
but this gave many compiler errors.

Trying
 typedef ublas::vector<double*> Vec;
uses a default container of
 ublas::unbounded_array<double*>
which is also not what I am looking for.

Again, the simple example:

  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] );

James