Description Usage Arguments Value Author(s) References See Also Examples
Transpose an array by permuting its dimensions.
1 | permdim.gdsn(node, dimidx, target=NULL)
|
node |
an object of class |
dimidx |
the subscript permutation vector, and it should be a permutation of the integers '1:n', where 'n' is the number of dimensions |
target |
if it is not |
None.
Xiuwen Zheng
http://github.com/zhengxwen/gdsfmt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # cteate a GDS file
f <- createfn.gds("test.gds")
(node <- add.gdsn(f, "matrix", val=matrix(1:48, nrow=6),
compress="ZIP", closezip=TRUE))
read.gdsn(node)
permdim.gdsn(node, c(2,1))
read.gdsn(node)
(node <- add.gdsn(f, "array", val=array(1:120, dim=c(5,4,3,2)),
compress="ZIP", closezip=TRUE))
read.gdsn(node)
mat <- read.gdsn(node)
permdim.gdsn(node, c(1,2,3,4))
stopifnot(identical(mat, read.gdsn(node)))
mat <- read.gdsn(node)
permdim.gdsn(node, c(4,2,1,3))
stopifnot(identical(aperm(mat, c(4,2,1,3)), read.gdsn(node)))
mat <- read.gdsn(node)
permdim.gdsn(node, c(3,2,4,1))
stopifnot(identical(aperm(mat, c(3,2,4,1)), read.gdsn(node)))
mat <- read.gdsn(node)
permdim.gdsn(node, c(2,3,1,4))
stopifnot(identical(aperm(mat, c(2,3,1,4)), read.gdsn(node)))
# close the GDS file
closefn.gds(f)
# remove unused space after permuting dimensions
cleanup.gds("test.gds")
# delete the temporary file
unlink("test.gds", force=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.