Description Usage Arguments Details Value Examples
(ijk2n)
Probably, it is worth running the examples before
trying to understand the following explanation!
ii[k] (or ii[i,k] is supposed to be a value in 1:di[k],
this function returns the global index obtained by
running the nested loops ii[k] (or ii[i,k]).
The reverse computation is done by n2ijk
(n2ijk)
From a global index obtained by
running the nested loops according to di returns the matrix
ii each row of which is the corresponding value in 1:di[k].
The reverse computation is done by ijk2n
1 2 3 |
ii |
vector of integers or a matrix of them. |
di |
vector of integers giving the dimensions of each sub-index. |
n |
an integer vector with values in between 1 and prod(di). |
monitor |
List providing the monitoring constants, see rbsa0$monitor$v to know the contents. |
When ii is a matrix, this is equivalent to call the function
repeatedly for each row.
length(ii) (or ncol(ii)) is supposed to be equal to length(di).
(ijk2n)
a positive integer (or a vector of length nrow(ii).
(n2ijk)
a matrix of dimension c(length(n),length(di)).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
##
## ijk2n
for (i1 in 1:4) { for (i2 in 1:2) { for (i3 in 1:3) {
print(c(i1,i2,i3,ijk2n(c(i1,i2,i3),c(4,2,3))));
}}}
glo <- cbind(rep(1:4,each=6),rep(rep(1:3,each=2),4),rep(1:2,12));
print(cbind(glo,ijk2n(glo,c(4,3,2))));
##
## n2ijk
for (n in 1:24) {
print(c(n,n2ijk(n,c(4,2,3))));
}
print(cbind(1:24,n2ijk(1:24,c(4,3,2))));
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.