Boost logo

Boost Users :

Subject: Re: [Boost-users] multi-array and pdes
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-05-22 13:17:26


On 05/22/11 10:53, petros wrote:

> Hi Larry,
> apologies, for not being clear.
No problem.

> Yes, MA is boost::multi_array. M, N, L are the dimensions (this is
> only a "logical" statement, rather than a proper code snippet).

> I think I have pretty much sorted out the calling practices wrt
> multi-aray and looking for if certain functionality exists.

> My problem amounts to having a view that would allow for the permutation
> (if not rotation) of axes.

I'm not sure I understand permutation and rotation. For example, say
you have:

  multi_array<T,2> ma2(extents[3][4]);

The array would have 3 rows and 4 columns. Now, since there are only
2 axes (row and column) permuting the axes would be transposing the
matrix. Is that right. In general, for:

  multi_array<T,N> maN(extents[L[0]][L[1]]...[L[(N-1)]]);

a permutaion of the axes could be specified by a permutation, p, of:

  (0,1,...,N-1)

and the resulting array, maT, would satisify, for all:

  unsigned i[N];

such that for all axis in (0...N-1), i[axis]<L[axis]:

  maN[i[0]][i[1]]...[i[N-1]] == maT[i[p[0]]][i[p[1]]]...[i[p[N-1]]]

If this is what you mean, then this could be done using the stepper
data structure mentioned here:

http://article.gmane.org/gmane.comp.lib.boost.devel/218623/match=index_list

The q_i in that post corresponds to the p vector (which is a
permutation of (0...N-1) mentioned above.

The book referenced in that post also has a section on rotation;
hence, it may be useful for that also.

[snip]
> I hope this is clearer now - don't mean to drag you into my
> problem. Thank you for your response,
[snip]

You're welcome, Petros.

HTH.

-Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net