c++ - filling a boost vector or matrix -
Is there a single expression method that specifies the scalar for all the elements of the matrix or vector? I am trying to find a more compact way of representing:
boost :: numeric :: ublas :: c_vector & lt; Float, N & gt; V; For (size_t i = 0; i The following do not work:
Prompt: numeric :: ublas :: c_vector < Float, N & gt; V (myScalar, myScalar, ... and so on ..., myScalar); Promotion :: Numeric :: ublas :: c_vector & lt; Float, N & gt; V; V = myScalar;Because vector should be able to use a standard random access container model STL Algorithm something like this:
c_vector & lt; Float, N & gt; Vec; Std :: fill_n (vec.begin (), n, 0.0f);or
std :: fill (vec.begin (), vec.end (), 0.0f);This is probably compatible with Boost. Assign but you have to check.
Comments
Post a Comment