search for: rtensor

Displaying 4 results from an estimated 4 matches for "rtensor".

Did you mean: tensor
2023 Aug 06
1
Stacking matrix columns
Avi, I was not trying to provide the most economical solution. I was trying to anticipate that people (either the OP or others searching for how to stack columns of a matrix) might be motivated by calculations in multilinear algebra, in which case they might be interested in the rTensor package. On Sun, Aug 6, 2023 at 6:16?PM <avi.e.gross at gmail.com> wrote: > > Eric, > > I am not sure your solution is particularly economical albeit it works for arbitrary arrays of any dimension, presumably. But it seems to involve converting a matrix to a tensor just to undo...
2023 Aug 06
1
Stacking matrix columns
...roject.org>; Steven Yen <styen at ntu.edu.tw> Subject: Re: [R] Stacking matrix columns Stacking columns of a matrix is a standard operation in multilinear algebra, usually written as the operator vec(). I checked to see if there is an R package that deals with multilinear algebra. I found rTensor, which has a function vec(). So, yet another way to accomplish what you want would be: > library(rTensor) > vec(as.tensor(x)) Eric On Sun, Aug 6, 2023 at 5:05?AM Bert Gunter <bgunter.4567 at gmail.com> wrote: > > Or just dim(x) <- NULL. > (as matrices in base R are just...
2023 Aug 06
1
Stacking matrix columns
Stacking columns of a matrix is a standard operation in multilinear algebra, usually written as the operator vec(). I checked to see if there is an R package that deals with multilinear algebra. I found rTensor, which has a function vec(). So, yet another way to accomplish what you want would be: > library(rTensor) > vec(as.tensor(x)) Eric On Sun, Aug 6, 2023 at 5:05?AM Bert Gunter <bgunter.4567 at gmail.com> wrote: > > Or just dim(x) <- NULL. > (as matrices in base R are just...
2023 Aug 06
1
Stacking matrix columns
Or just dim(x) <- NULL. (as matrices in base R are just vectors with a dim attribute stored in column major order) ergo: > x [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 > x<- 1:20 ## a vector > is.matrix(x) [1] FALSE > dim(x) <- c(5,4) > is.matrix(x) [1] TRUE > attributes(x) $dim [1] 5 4 > ## in painful and unnecessary detail as dim() should