Feature #811
Vector initialization via arrays
Status: | Resolved | Start date: | 01/20/2012 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | M. Rolf | % Done: | 100% | |
Category: | - | |||
Target version: | NemoMath 0.4 |
Description
It would be nice to initialize a vector with an array of the specific type, e.g. something like this:
double values[my_dim];
...
RealVector v(dim(my_dim), values);
Thx ;)
History
#1 Updated by M. Rolf about 12 years ago
- Target version set to NemoMath 0.4
#2 Updated by M. Rolf about 12 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
In order to avoid type confusion among the overloaded constructor, this one uses a static factory method:
double vals[3]; vals[0] = 1.0; vals[1] = 2.0; vals[2] = 3.0; RealVector vec = RealVector::fromArray(dim(3),vals);