Re: [eigen] matrix::linspace |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] matrix::linspace
- From: Ricard Marxer Piñón <email@xxxxxxxxxxxxxxxx>
- Date: Mon, 25 Jan 2010 19:50:53 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:content-transfer-encoding; bh=Et/XA4a5Hjg/+bRUUrMA4wg8HnL9EMzcp2qJ/sJW5Bg=; b=gjIfgl2HSWH/zaKmrJomFZm8qOTJPshGL1Z5tSE1SW5lPxGluXicnqBeKbwTaCPK8w hc0d/UmzeqhjoztaNvJCCUD/FnJR9nWQ3HYAVzad64FreX2TL/4MbnPpFbLvR5s2U7Xf 28v1mLMheWnHMNyE1lIsA5c5LuIFdftQPL9MI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=p+cjTMMJ9UP1vKjxWPYKx2di61WYe2i9jgFZp8HpO3lJ1bN04iwt57PkljlkERYLBi C4Yd2nt+VKLkXEYb9cMWVvNUADbXtiF751cp9/ARQQhe3O3TgeuDh8ki74F0BWZ4ZtCo 4wwPbs1kIeoZ5bhGgGpP4XBitIgwc8LSDclKQ=
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 the spirit of the other ones: Random, Zero, Constant and Ones.
Doest this make sense?
ricard
On Mon, Jan 25, 2010 at 6:31 PM, Hauke Heibel
<hauke.heibel@xxxxxxxxxxxxxx> wrote:
> Ok, I am done. I have the whole patch ready for review. Since I have
> no idea what else to do for reviewing larger commits, I am posting
> here.
>
> The main new functionality offered is
>
> DenseBase::setLinSpace(Scalar l,Scalar h,int s)
>
> which computes for each vector index
>
> a(i) = l + i*(h-l)/(s-1)
>
> Now to the changes this involves.
>
> a) I added a new packet op ei_plset(Scalar a). It creates packages [a,
> a+1, ..., a+packet_size]. The nice part as opposed to ei_pset(...) is
> that for all types (float, double, int) there is only a single
> argument and not a varying number of arguments. This also allows to
> offer a GenericPacketMath implementation where this operator acts as
> identity.
>
> b) I added new constraints for functors that are meant to be used with
> CwiseNullaryOp. They are now required to offer a vector indexing
> operator()(int). For minimal invasive modifications, I simply changed
> existing ones by defining operator()(int,int) as operator()(int,int =
> 0) - where it was appropriate. That was already partially done.
>
> c) As discussed, ei_linspace_op_impl has two specializations one for
> random access and one for sequential or linear access. The vectorized
> sequential versions are much faster than non-vectorized ones and the
> random access versions seem to perform equally fast and faster (at
> least not worse).
>
> d) I introduced a new proxy ojbect ei_unaligned_assign_impl. It
> performs a simple loop assignment when required and it does not
> inline. Preventing the inlining was crucial in order to allow MSVC to
> perform proper optimization of packet ops. Maybe this should be
> guarded by a pre-processor define and activated only for MSVC.
>
> If I am not wrong, this is all. Any comments, or am I good to synch?
>
> - Hauke
>
--
ricard
http://www.ricardmarxer.com
http://www.caligraft.com