-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Array works fine:
r$> ## array
x <- dcdim(array(1:6, c(2, 3, 1)))
r$> x1 <- dclone(x, 1)
r$> x2 <- dclone(x, 2)
r$> x
, , 1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"drop")
[1] TRUE
attr(,"class")
[1] "dcdim" "array"
r$> x1
, , 1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"drop")
[1] TRUE
attr(,"class")
[1] "dcdim" "array"
r$> x2
, , clone.1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
, , clone.2
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"n.clones")
[1] 2
attr(,"n.clones")attr(,"method")
[1] "dim"
attr(,"n.clones")attr(,"method")attr(,"drop")
[1] TRUE
r$> stopifnot(all(dim(x1) == dim(x)))
r$> stopifnot(all(dim(x2) == dim(x)*c(1,1,2)))Should the matrix case add a 3rd dim when k=1?
r$> ## matrix
x <- dcdim(matrix(1:6, 2, 3))
r$> x1 <- dclone(x, 1)
r$> x2 <- dclone(x, 2)
r$> x
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"drop")
[1] TRUE
attr(,"class")
[1] "dcdim" "matrix" "array"
r$> x1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"drop")
[1] TRUE
attr(,"class")
[1] "dcdim" "matrix" "array"
r$> x2
, , clone.1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
, , clone.2
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
attr(,"n.clones")
[1] 2
attr(,"n.clones")attr(,"method")
[1] "dim"
attr(,"n.clones")attr(,"method")attr(,"drop")
[1] TRUE
r$> stopifnot(all(dim(x1) == dim(x)))
r$> stopifnot(all(dim(x2) == dim(x)*c(1,2)))
Error: all(dim(x2) == dim(x) * c(1, 2)) is not TRUE
In addition: Warning message:
In dim(x2) == dim(x) * c(1, 2) :
longer object length is not a multiple of shorter object lengthReactions are currently unavailable