开发者

Generating permutations corresponding to periodic lattice translations in c++

Suppose I have a sequence of characters (ABCDEF....), in an array or a string or any suitable data structure, and these characters are distributed over the sites if a 3D lattice, such 开发者_开发百科that position 1 corresponds to coordinates (1,1,1) and so on. When I perform any operation on this lattice, i.e., periodic translation in x-direction which means all elements are shifted cyclically in the direction of x, this should alter the sequence of characters in my data structure accordingly. My question: which data structures/functions/libraries can do these permutations efficiently in c++? Speed is important because this has to be done many times.


In 1D, you could think about it as a circular doubly linked list. The advantage would be that you could use an STL list container and make your life easier.

The exercise of extending this to 3D is left to the reader.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜