Re: [eigen] Feature request

[ Thread Index | Date Index | More Archives ]

Hello Rasmus,
thank you very much for your answer.
I did have a look to the slice and strided slice methods.

But they are not really the same, because they assume that you have stored the entire domain in a Tensor object and then you extract a slice from it to perform an operation.

In my case, I am splitting a very large cube into different processors via MPI bacause there is no way to keep all this in memory in one machine, and I would like that the allocation of each of the processors preserves the coordinates from the original cube. 

All best!

On Thu, Apr 18, 2019 at 8:03 PM Rasmus Munk Larsen <rmlarsen@xxxxxxxxxx> wrote:
Hi Jaime,

I know this is sort of the opposite of what you ask, but did you consider the Block interface in Eigen core or the slice (and stridedSlice) methods in the Tensor class? They provide low-overhead views of blocks offset from zero.


On Thu, Apr 18, 2019 at 1:08 AM Jaime de la Cruz Rodríguez <rematedeltomate@xxxxxxxxx> wrote:
I have been using Eigen3 in my codes, mostly the matrix class to solve linear systems and to perform SVD calculations. It is great!

Recently I have also found the Tensor class extremely useful, as it provides multidimensional arrays in c++ with delayed evaluation. A feature that I have been missing is the possibility of starting indexing an array from any number (aka, the first element of a dimension is not index zero). This feature would simplify greatly dealing with applications where domain decomposition is required. We are writing a new radiative transfer code and I would like to use Eigen3 to deal with arrays internally.

Would it be possible to add such feature?  

The constructor could be such that it takes N arguments or 2*N arguments. In the latter case, we would have two numbers for each dimension the initial element and the final element. In the former case we would have the current behavior.

In practice implementing this feature is relatively easy and it only requires storing the offset for each dimension. The linearized array offset is calculated also very similarly, but removing the offset from the index before multiplying by the corresponding stride.

I have coded a simple array class with these features but it is missing all the bells and whistles of Eigen, so I would prefer to use the latter.

Also, I have made one of my codes publicly available and it uses Eigen, in case you want to add it to the list of codes using Eigen3:

Best regards!

Mail converted by MHonArc 2.6.19+