Displaying 20 results from an estimated 30000 matches similar to: "zero-extent matrices (PR#958)"
1999 Mar 02
0
[R] zero-offset matrices (PR#132)
Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:
> "[<-.zoffset" <- function(x, i, j, value)
> {
> if(!missing(i) && is.numeric(i)) i <- i+1
> if(!missing(j) && is.numeric(j)) j <- j+1
> NextMethod("[<-")
> }
> works in S but not in R. (Which I think is a bug.) I next tried
Yup, there's a bug in there
1998 Apr 09
1
0-extent matrices?
Is there a good reason not to allow matrix extents to be zero? I have been
writing a function which fits glms under certain linear constraints. I
fit the model with a reduced set of variables and then transform back to
the original set. This involves operating on submatrices of the
covariance matrix and subsets of the coefficients. Sometimes these subsets
are empty. A zero-length subset of the
2024 Jun 26
1
rbind() on zero row matrices is inconsistent
The help for cbind() and rbind() says
"For cbind (rbind), vectors of zero length (including NULL) are ignored
unless the result would have zero rows (columns), for S compatibility.
(Zero-extent matrices do not occur in S3 and are not ignored in R.)"
This leads to an inconsistency.
M <- matrix(NA, 0, 0) # Make a 0x0 matrix
N <- matrix(NA, 0, 1) # Make a 0x1 matrix
2005 Apr 13
5
Binary Matrices
I'm wanting to perform analysis (e.g. using eigen()) of binary matrices - i.e. matrices comprising 0s and 1s.
For example:
n<-1000
test.mat<-matrix(round(runif(n^2)),n,n)
eigen(test.mat,only.values=T)
Is there a more efficient way of setting up test.mat, as each cell only requires a binary digit? I imagine R is setting up a structure which could contain n^2 floats.
Thanks in advance
2011 Nov 29
3
fill binary matrices with random 1s
Dear all, I am finding difficulty in the following, I would like to
create an empty matrix e.g. 10x10 of 0s and sequentially fill this
matrix with randomly placed a 1s until it is saturated. Producing 100
matrices of sequentially increasing density., This process needs to be
randomized 1000 times., I assume i should run this along the following
lines, 1) Create 1000 matrices all zeros, 2) add
2008 Jun 18
1
operations on all pairs of columns from two matrices
m1 <- matrix(rnorm(40), ncol=4)
m2 <- matrix(rnorm(40), ncol=4)
I would like to subtract first column of m1 from all columns of m2, subtract 2nd of m1 from all columns of m2, and so on. Obviously, I am not using the appropriate function outer(m1, m1, "-"), since the first column isn't all 0s.
_________________________________________________________________
2009 Jul 28
3
selecting vector elements using matrices and combining the results
I've been scratching my head over this one for too long. I'm hoping
someone out there can solve this riddle.
I have two vectors of characters, v1 and v2, both of length L, and two
matrices of logicals, m1 and m2, both of dimension N*L. The first matrix
of logicals corresponds to the first vector of characters, and the second
to the second.
The matrices are telling me which of the
2005 May 31
1
Loading matrices and other things
Hi all,
I'm new to R, so needless to say I have a couple questions (which I hope
I haven't missed through the documentation).
I have several files in lower triangular matrix form. For each of these
matrices, I want to perform some form of hierarchical clustering on each
matrix and capture the output of the clustering.
The first problem I run into is actually loading the matrix file
2024 Jun 10
1
changes in R-devel and zero-extent objects in Rcpp
> Date: Sat, 8 Jun 2024 19:16:22 -0400
> From: Ben Bolker <bbolker at gmail.com>
>
> The ASAN errors occur *even if the zero-length object is not actually
> accessed*/is used in a perfectly correct manner, i.e. it's perfectly
> legal in base R to define `m <- numeric(0)` or `m <- matrix(nrow = 0,
> ncol = 0)`, whereas doing the
1999 Mar 02
1
zero-offset matrices
Has anyone written subscripting methods for matrices which are indexed
from zero? i.e. functions such as "[.zoffset" and "[<-.zoffset" which
would allow, given an appropriate function "zmatrix"
"zmatrix" <- function(...)
{
robj <- matrix(...)
class(robj) <- "zoffset"
robj
}
fred <- zmatrix(1:20, 4, 5)
fred[0, 4] # would be 17
2003 Feb 11
1
mean function on correlation matrices (PR#2540)
Full_Name: Raymond Salvador
Version: R 1.6.2
OS: Windows ME
Submission from: (NULL) (131.111.93.195)
The mean function applied on individual components of several correlation
matrices
gives a wrong result (gives the first value instead of the mean).
Here there is a simple example
x1 <- rnorm(10,1,1)
y1 <- rnorm(10,1,1)
z1 <- cbind(x1,y1)
w1 <- cor(z1)
x2 <- rnorm(10,1,1)
y2
2009 Mar 25
1
get_all_vars fails with matrices (PR#13624)
Hi,
According to the help file for model.frame/get_all_vars, the following should
produce the same output from both functions, but it doesn't...
> dat <- list(X=matrix(1:15,5,3),z=26:30)
> model.frame(~z+X,dat)
z X.1 X.2 X.3
1 26 1 6 11
2 27 2 7 12
3 28 3 8 13
4 29 4 9 14
5 30 5 10 15
> get_all_vars(~z+X,dat)
[1] z X <NA> <NA>
<0
2017 Sep 27
1
logic ops with zero-extent raw vectors
Hi,
there was a change concerning logical operations about a year ago:
https://github.com/wch/r-source/commit/9e19d3e3dd5f657b5cfefe562bdd7ede2e2b8786
It's related to a discussion on this list:
https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html <https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html>
A change in logic.c:134 influences the
2005 Jun 02
1
print()ing of raw matrices (PR#7912)
Not a bug in a very strict sense,
but still something to be fixed eventually:
> s <- sapply(0:7, function(i) rawShift(charToRaw("my text"),i))
> s
... nothing is printed at all
> str(s)
raw [1:7, 1:8] 6d 79 20 74 ...
> c(s)
[1] 6d 79 20 74 65 78 74 da f2 40 e8 ca f0 e8 b4 e4 80 d0 94 e0 d0 68 c8 00 a0
[26] 28 c0 a0 d0 90 00 40 50 80 40 a0 20 00 80 a0 00 80 40 40 00
1998 Jul 30
1
zero-extent matrix crash
Anyone for a little debugging?
> matrix(numeric(0),0,0)
Floating point exception (core dumped)
[I've decided to make a habit of sending bugs that I'm not going to
attack right away to R-devel, in case someone might be interested in
chipping in and saving the core team the work]
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics
2001 Mar 23
1
eigen segfaults on 0-diml matrices (PR#882)
>From one of my students' simulations:
m <- matrix(1, 0, 0) # 1 to force numeric not logical
eigen(m)
and segfault in TRED2 in src/appl/eigen.f
Easy to fix, but I wonder what else might have been overlooked?
(svd is protected).
--please do not edit the information below--
Version:
platform = sparc-sun-solaris2.7
arch = sparc
os = solaris2.7
system = sparc, solaris2.7
status =
2002 Sep 03
1
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
2000 Jul 05
0
svd() (Linpack) problems/bug for ill-conditioned matrices (PR#594)
After fixing princomp(), recently,
{tiny negative eigen-values are possible for non-negative
definite matrices}
Fritz Leisch drew my attention to the fact the not only eigen() can be
funny, but also svd().
Adrian Trappleti found that the singular values returned
can be "-0" instead of "0". This will be a problem in something like
sd <- svd(Mat) $ d
2006 Jan 27
3
e1071: using svm with sparse matrices (PR#8527)
Full_Name: Julien Gagneur
Version: 2.2.1
OS: Linux (Suse 9.3)
Submission from: (NULL) (194.94.44.4)
Using the SparseM library (SparseM_0.66)
and the e1071 library (e1071_1.5-12)
I fail using svm method with a sparse matrix. Here is a sample example.
I experienced the same problem under Windows.
> library(SparseM)
[1] "SparseM library loaded"
> library("e1071")
2024 Jun 08
1
changes in R-devel and zero-extent objects in Rcpp
A change to R-devel (SVN r86629 or
https://github.com/r-devel/r-svn/commit/92c1d5de23c93576f55062e26d446feface07250
has changed the handling of pointers to zero-length objects, leading to
ASAN issues with a number of Rcpp-based packages (the commit message
reads, in part, "Also define STRICT_TYPECHECK when compiling inlined.c.")
I'm interested in discussion from the