[eigen] Tensor Module: chip off multiple dimensions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Tensor Module: chip off multiple dimensions
- From: Gabriel <gnuetzi@xxxxxxxxx>
- Date: Wed, 23 Dec 2015 16:50:48 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=7kMNeHo2Jte1R8LzDIfje9lFDefsQ2eO8EmSGGs+u68=; b=gJRJ09JcT/q4QNbSWVSQvtxCLp3ipiWFWaxSgL1Vo7uBKocG0gZ0xN2luzzpN4VaDs fVjw3xekqLPZJg1FRcJBQ7LET1lFwqQCCBh8NwedfctBA8R64X7RGdexw6G6Aod2XzaR 1V4gPVj2+L+wGocB2tBkcLAd5haeLqGeN0t1YyQW4GueZiHfrYGqRytRrbrNSwtIEAtG o+RO5Q6EKpbCaVyUZEY1AsjJLfrvib8uIG7IUS4TqXFGHQS7c8qTR58EM9RvZphHltTC O4c4sU6NBfH24zKPijNHbDinyQ/fAYZQhWHSc8Uym2h6ReZAFiaaeKm/9d/6W19HxyX5 MjXA==
Hello :-)
I have a short stupid question
I would like to extract the last two dimensions as a 2d Eigen Matrix
Tensor< double, 4> tensor(6,6,2,2);
in python notation:
tensor[1,1,:,:] -> map his array in a Eigen::Matrix<double,2,2> or
leave it as a 2d tensor
How is this possible with chipping?
tensor.chip(0,1).chip(0,1) gives me the 2d Tensor of the last two
dimensions
Is there a short cut to this?
I have a class which has a 5d tensor as member where I would like to
have a
getElement(i,j,k)
function which then chips off the first 3 dimensionsand returns the
chipping expression as reference to be able to work on the remaining 2d data
thanks a lot!
On 10/07/2015 06:31 PM, Nathan Yonkee wrote:
That is correct Gabriel the data is stored in a single, fixed size array, the data is also aligned in case you have vectorized CPU insructions (SSE or AVX). I'm only confident for fixed sized objects, it may be different if you use dynamically sized ones.
An aside, all of the values in an array are contiGuous in memory - meaning their addresses are sequential; a chunk of aligned memory (2 or 4 doubles) is truly contiNuous so that the CPU can "blindly" operate on a whole chunk in one cycle.
On Wed, 7 Oct 2015 14:51:03 +0200
Gabriel <gnuetzi@xxxxxxxxx> wrote:
Hello =)
Trying to use the Tensor module to store some 3d Matrix and save it into
a HDF5 file.
Question:
When I do
Tensor<double,3> *a*(19,4,3);
is *a* then guaranteed to be continuous in memory as it is the case for
all DenseBase<> objects? As far as I am aware off :-)
Thanks !
BR Gabriel Nützi