
Ublas : 
From: Rob McDonald (ramcdona_at_[hidden])
Date: 20080820 16:26:51
I would like to be able to have a bounded_vector<double, 3> which I can
instantiate something like this...
typedef bounded_vector<double, 3> vect;
vect v = vect(0.0, 1.23, 3.45);
This requires a new constructor of the form
bounded_vector(T x, T y, T z);
Since constructors and the equals operator aren't inherited, I can't
just implement this one constructor. And, while I'm at it, I may as
well keep the code generic to type, but specific to 3 elements...
So, I've copied the code for a bounded_vector from vector.hpp. So far,
all I've really done is change the template parameter N to a 3. At this
point, I can't figure out how to implement my desired constructor...
I need to either 1) access the data directly or 2) use the available
interface.
I poked around in the source such that 'data () [i] =' looked like it
might be promising, but that doesn't seem to work. No combinations of
'this(i) =' or what not have worked either.
For 1), I haven't been able to figure out for sure where the data is
really stored and if I have access permissions to it.
For 2), I haven't been able to figure out how to access the overloaded
() operator in the constructor.
Here is one of many failed attempts:
BOOST_UBLAS_INLINE
bounded_vector3 (T x, T y, T z):vector_type(3){
data () [0] = x;
data () [1] = y;
data () [2] = z;
}
After I get that working, I have another similar challenge...
I would like to be able to assign one of these vectors with a comma
delimited list. This is currently done in Blitz++, and I am migrating
some code from Blitz to boost::ublas.
So, I want to be able to do this....
vect v;
v = (1.2), (3.5), (7.8); // I'm not sure if the () are significant.
Any help will be greatly appreciated,
Rob