Re: [eigen] Feature request for array |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Feature request for array
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 8 Jan 2010 09:46:12 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=B/Z+UcJe4a0ZnXzOoYl4eNK6dfGdSURtULp24noyJ5w=; b=GPJJQ7rXIrdzZHnSyZ+Hik1C4nZU8OPCArTcj7LNESKA1wzMC9XQk8M4hlUCcTqxgZ nOU1PLZ0Cs0CwUdsXVGnycwSFHd1ISJ57ZJuo67MrGJAGMzjjuZSBNsq0f64MXguSgYT 3DzWxe6DbJtStZZ+p6SW8BDaHfGmwM7OK+tqk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nInKn70M+tGg2JFPB60okFQpRQIkCCPRyRnwWPPXCxhrASWO+gqA4fWATAWl0FIc+P EpU+XPe2EqZCM8fYvTPew17pOyOcYk5n9H9lpH1964BIMk40AT11pi1/pC7/4Qvdt/Dg F2qI1SUkDe0EUqvSupsNVm3fCPxe7/r6dE4oc=
This is well-tested already, don't worry. If you know the size of the
segment at compile time, you can use this: segment<7>(4). If
furthermore you know that the start of the segment is at an aligned
location, well, I don't think Eigen 2.0 is able to understand that,
but in the devel branch, you could at least use MapAligned.
Benoit
2010/1/8 Jinglei Hu <jingleihu@xxxxxxxxx>:
> Good to know, thanks. I'm wondering if there will be any performance test
> regarding the array part?
>
> Jinglei
>
> Benoit Jacob wrote:
>>
>> So, exactly as Rohit says, we have a segment() function for that:
>>
>> A.segment(first,size) = B.segment(first,size) + C.segment(first,size);
>>
>> so for 4..10 you would use segment(4,7).
>>
>>
>> http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a4d9f2188195e410a09ea180032d6b9a1
>>
>> Benoit
>>
>> 2010/1/8 Jinglei Hu <jingleihu@xxxxxxxxx>:
>>
>>>
>>> Exactly, "slicing".
>>>
>>> Really cool to have such function. And if its performance can be
>>> comparable
>>> to Fortran, it would be very attracting.
>>>
>>> Jinglei
>>>
>>> Aron Ahmadia wrote:
>>>
>>>>
>>>> Dear Jinglei,
>>>>
>>>> I think so too, also, the word you are looking for is 'slicing'.
>>>> Stencil refers usually to the discretization of a differential
>>>> operator, which when performed on a finite difference/finite element
>>>> discretization, usually refers to a local slice of your array around
>>>> the evaluation point.
>>>>
>>>> HTH,
>>>> A
>>>>
>>>> On Fri, Jan 8, 2010 at 10:06 AM, Rohit Garg <rpg.314@xxxxxxxxx> wrote:
>>>>
>>>>
>>>>>
>>>>> I think this can be done TODAY in eigen using segments.
>>>>>
>>>>> 2010/1/8 Jinglei Hu <jingleihu@xxxxxxxxx>:
>>>>>
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Eigen is really a nice piece of work. Thanks!
>>>>>>
>>>>>> In scientific computing, one and two (or even higher) dimensional
>>>>>> arrays
>>>>>> are
>>>>>> widely used. It would be nice to have the following function:
>>>>>>
>>>>>> 1dArray A(10), B(10), C(10);
>>>>>> A(4:10) = B(4:10) + C(4:10);
>>>>>>
>>>>>> I do not know the professional term for this, maybe stencil? In
>>>>>> fortran,
>>>>>> this function for array is built-in. Blitz++ provides such function
>>>>>> for
>>>>>> array and claimed performance in par with fortran. How about
>>>>>> incorporating
>>>>>> this staff in Eigen?
>>>>>>
>>>>>> Cheers,
>>>>>> Jinglei
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Rohit Garg
>>>>>
>>>>> http://rpg-314.blogspot.com/
>>>>>
>>>>> Senior Undergraduate
>>>>> Department of Physics
>>>>> Indian Institute of Technology
>>>>> Bombay
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
>