oehl_list@gmx.de
2002-Sep-03 15:45 UTC
matrices and arrays loose dimension after multiplying with scalar (PR#1979)
A matrix or array with one of its dimensions having zero elements looses its dimension after multiplying with scalar. Admittedly this is an extreme case, however it DOES make sense to retain an objects formal structure after multiplying with a scalar, as e.g. a matrix with zero rows IS a legal object in S. BTW, the prototype does retain the dimension. Best Jens Oehlschlägel # replication code at the end # R1.5.1> m <- matrix(1, nrow=0, ncol=3) > m[,1] [,2] [,3]> m*100numeric(0)> > m <- matrix(1, nrow=3, ncol=0) > m > m*100numeric(0)> > a <- array(1, dim=c(2, 2, 0)) > a > a*100numeric(0) # Prototype> m <- matrix(1, nrow=0, ncol=3) > minteger matrix: 0 rows, 3 columns.> m*100integer matrix: 0 rows, 3 columns.> > m <- matrix(1, nrow=3, ncol=0) > minteger matrix: 3 rows, 0 columns.> m*100integer matrix: 3 rows, 0 columns.> > a <- array(1, dim=c(2, 2, 0)) > ainteger array: 2 by 2 by 0> a*100integer array: 2 by 2 by 0 # replication code m <- matrix(1, nrow=0, ncol=3) m m*100 m <- matrix(1, nrow=3, ncol=0) m m*100 a <- array(1, dim=c(2, 2, 0)) a a*100> version_ platform i386-pc-mingw32 arch i386 os Win32 system i386, mingw32 status major 1 minor 5.1 year 2002 month 06 day 17 language R -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
maechler@stat.math.ethz.ch
2002-Sep-03 16:01 UTC
matrices and arrays loose dimension after multiplying with scalar (PR#1979)
>>>>> "JensOe" == oehl list <oehl_list@gmx.de> >>>>> on Tue, 3 Sep 2002 17:45:33 +0200 (MET DST) writes:JensOe> A matrix or array with one of its dimensions having JensOe> zero elements looses its dimension after multiplying JensOe> with scalar. Admittedly this is an extreme case, JensOe> however it DOES make sense to retain an objects JensOe> formal structure after multiplying with a scalar, as JensOe> e.g. a matrix with zero rows IS a legal object in JensOe> S. BTW, the prototype does retain the dimension. JensOe> Best Danke, Jens! o still happens in R-devel (aka 1.6.0 "unstable") of today. o yes, it's a bug though not a high-priority one {and we are approaching deep feature freeze real soon now...} Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Seemingly Similar Threads
- analysis of function dependencies / namespacing
- analysis of function dependencies / namespacing
- Re: CRAN packages maintained by you (subscripting problem under 1.9.0.alpha?)
- names(unlist(...)) may construct corrupt strings (PR#1524)
- Multiplying a list of matrices with a vector