the index that lays out an array whose first and second index run along d = (d1, d2) as gL asks, new[r, c] = old.flat[lin[r, c]]; MATLAB’s gridLayout.layoutIndex
Syntax
lin = layoutIndex(gL, (d1, d2), A.shape)
A.flat[lin] is A laid out in gL.
lin, t = layoutIndex(gL, (d1, d2), A.shape, return_transpose=True)
And whether it transposes.
lin = layoutIndex(gL, (d1, d2), A.shape, nearest=True)
The closest layout a reindexing reaches.
Description
Two layouts of one grid differ by a transpose and flips of the two axes, which is all a reindexing can express. The index transposes where the axes are crossed and flips an axis that runs backwards. A tie, a grid turned by 45 degrees, keeps the order unless the column direction of gL is nearer y than x.
The inverse is the same call with the two layouts swapped. The source is given as two directions, since a grid may be sheared, or as the gridLayout it is in. Dimensions beyond the first two are left alone.
Input
gL |
gridLayout, the layout the array is to be laid out in, the target |
d |
(d1, d2), vector3d, the directions the first and the second index advance along, or the gridLayout the array is in |
shape |
the shape of the array |
Keywords
| keyword | default | description |
|---|---|---|
nearest |
False |
take the layout a transpose and flips reach closest, where otherwise directions that differ by more than a signed permutation are refused |
return_transpose |
False |
also return t, MATLAB’s second output |
Output
lin |
an integer array of the reindexed shape, the linear indices into the array |
t |
whether the first two dimensions were exchanged (return_transpose): a transpose also exchanges whatever is indexed by dimension, a pixel step or a size |
See also
gridLayout, gridify, referenceFrame.transformationMatrix
MATLAB’s gridLayout.layoutIndex
source
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/gridLayout.layoutIndex_py.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.