Re: [eigen] Vector generators

[ Thread Index | Date Index | More Archives ]

We have some functions which might be offering what you are looking
for in the development branch:

1) setLinSpaced(const Scalar &low, const Scalar &high, int size), see
2) LinSpaced  (const Scalar &low, const Scalar &high, int size),
3) LinSpaced  (Sequential_t, const Scalar &low, const Scalar &high,
int size),

The third method is the fastes since it is setting up to 4 values in
one step though there is a slight approximation error involved due to
successive summation.
All methods have in common, that you may (actually, will most likely)
end up with your last element being

high + small error

which is caused by typical rounding errors.


On Sat, Apr 24, 2010 at 8:48 PM, Manoj Rajagopalan <rmanoj@xxxxxxxxx> wrote:
> Hi,
>   I frequently generate mesh-data of the form f((1:n)*factor), where n is the
> number of elements in the mesh, factor is some multiplicative factor
> (mesh-spacing), and f() is some function that operates on each of the
> generated values. Is something like this possible with concise syntax in
> eigen?
>   The quantity (1:n) can be thought of as an extension of the constant-vector
> concept. A further extension is the vector generated by (start,finish,delta).
> These vectors, like eigen's constant-vectors, can be concisely encoded and
> expanded at assignment-time.
> Thanks,
> Manoj

Mail converted by MHonArc 2.6.19+