$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
From: Ingo Nolden (nuttygraphics_at_[hidden])
Date: 2005-06-22 10:30:13
Toon Knapen schrieb:
> yanyaqin wrote:
> 
>>1. In ublas::vector, there's 3 constructions:
>>
>>|vector ()| 	Allocates an uninitialized |vector| that holds zero elements.
>>|vector (size_type size)|	Allocates an uninitialized |vector| that holds 
>>|size| elements.
>>|vector (const vector &v)|
>>
>>but how can i construct a vector with the default value like std::vector( n, value )
>>
> 
> You can't AFAICT. What you can do is
> ublas::vector< double > v(10) ;
> std::fill( v.begin(), v.end(), value ) ;
I was just looking for a solution to initialize or assign a vector or 
matrix with a number of values. This message was the closest to my 
question that I found.
blitz has a similar feature, that goes:
Vector<double> z;
z = 0.0, 0.0, 1.0;
Matrix<double> ident;
ident = 1.0, 0.0, 0.0
       , 0.0, 1.0, 0.0
       , 0.0, 0.0, 1.0
       ;
blitz is not really what I want but I liked this kind of initialization.
In uBlas I din't find any way to manually initialize or assign a vector 
or matrix.
Am I missing something?
Is nobody else in need for that?
Ingo