Re: [eigen] matrix::linspace |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] matrix::linspace
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Mon, 25 Jan 2010 20:14:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=UUxFheWmRrLGOs+4ERBkfHLOXv3pqVyyRP8k1OS2kgg=; b=rmv1gqpo9LMHk9dHumPjipCCwot5Yqod8Y/9zCVpgRAqDpCvwqQP40WMaFM3zouAYZ xTFEMldNCQYkEiCtJLTRG6GZMTu15UeidE/IEHyAZlBwMdXAyIIdasSEIOpZiuvLj+8y 5xWak0qAtmpmhxfVbBMdyMZehz33IXxo6eaEI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=VzWOFdeJbpw8lG8VfMN84IOOdkANk2Zg5hYyIeIo5EuKL6E3inGUx0Dr0bBcE5FA0h 7WtVEtuWhXZCkSgttjjbo6gi9zM2B4HggOsdn34awRVL4o5T0W6shIEc5XzBS+BrDXCu vDYv+e5pszRgz3DernPYuN0eXljg7t3di66y0=
On Mon, Jan 25, 2010 at 7:50 PM, Ricard Marxer Piñón
<email@xxxxxxxxxxxxxxxx> wrote:
> Thanks for this work, this will be really useful, at least for me for sure.
> I haven't checked if this is done or not yet, but it would be really
> nice to have a class that allows us to do:
>
> VectorXf::LinSpace(0, 10, 100)
In principle this is done. What you are asking for is just a shortcut for
VectorXf::NullaryExpr( 100, ei_linspace_op<Scalar>(0,10,100) );
I just did not yet add the shortcut. I am a bit reluctant since currently
VectorXf a;
a.setLinSpace(0,10,100);
and
VectorXf a = VectorXf::NullaryExpr( 100, ei_linspace_op<Scalar>(0,10,100) );
have different run-times (when vectorization/SIMD is enabled) though
the same semantics. For the shortcut you are requesting we need to
ensure that random access of vector elements is possible. In the first
case on the other hand side we are basically recreating a vector and
thus can take advantage of sequential element access. One might
circumvent the problem by adding a template parameter e.g.
VectorXd::LinSpace<Sequential>(0,10,100);
but I am not yet sure and IIRC default template parameters are not
possible for member functions.
> Doest this make sense?
Absolutely... and it will most likely come.
- Hauke