|Re: [eigen] Multi Dimensional Arrays|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Multi Dimensional Arrays
- From: Jim Bosch <talljimbo@xxxxxxxxx>
- Date: Tue, 08 Feb 2011 20:31:32 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=2KFNeUqxjisA6U23uPoWx42G7Yi6khCJRHxg5akr6lI=; b=KbLRUkOmhf725fToEJnm5lvRnYOu9TzFMhbqmCDE1PldsbEdF6Lyx4SFRsqkp0xDQ3 CnMzJ5eAU8aQlj3UAbmz72ND4n77kbS/TdGHiAnZAjeEeMG64RG6PTLdKXyYfU8G1cht GAMO4eRGNJyX5dckv2xhvBMJ5NTQzTh7Xd+2o=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=SsVszCU3MAzj2cRSqoxSVDq6ygQqNhjhnaf8UxMIb7BvuFtBphRGFn8AqmKWWqtU7h K5qb9O1VXIKjkVDN5erW4wjLPiZ41C/KD86IATlitn2dGMwhzctMaEvrPbtbSlsJKYGx VaIwUZe4taI6OaAnRS2nmO28mGOOPj1bWguec=
On 02/08/2011 06:45 PM, Benoit Jacob wrote:
I feel your pain, and I've been working on a multidimensional array library
that's designed to let Eigen do all the matrix math:
While that isn't the complete solution solution you're looking for, at least
it's a clear division of labor.
Essentially, while you can make an ndarray::Array of any dimension, you can
view 1- or 2-dimensional subarrays of those as Eigen-conforming objects, or
construct ndarray views into Eigen::Matrix objects.
This is a good approach, I'd like to encourage you in this direction.
I almost wrote back to the list to suggest that this might be the best
approach to take balancing reasonable performance with reasonable ease
Like with matrices, the hard part is products. The name of the game is
memory locality / cache friendliness. By leveraging Eigen's optimized
matrix product implementation and applying it to 2-dimensional slices
in your N-dim arrays, you should be able to get somewhere. Depending
on the storage order/ cases, you may have to copy slices into
temporaries to have them contiguously stored in memory.
It occurs to me that the bridge point for this might be an
Eigen::Map-like object that supports arbitrary strides in *both*
dimensions, and copies as necessary for performance; that would make it
possible to efficiently operate on any two dimensions of a
higher-dimensional array with Eigen. With something like that, a
multidimensional array library really could offload almost all of the
difficult optimizations to Eigen.
Oh, and apologies to Andy for the earlier incorrect correction on
That won't get you all the way there if your main application is
multidimensional tensor contractions, but it does provide a nice interface
for interfacing with Python/Numpy and moving Eigen-compatible objects around
with reference counting instead of deep copies.