Displaying 20 results from an estimated 10000 matches similar to: "diag(x, n) not preserving integer and logical x"
2014 Aug 07
1
RFC: diag(x, n) not preserving integer and logical x
This is not at all something new(*). As maintainer of the
Matrix package, I don't like this inconsistency of base R's diag().
We have had the following -- forever, almost surely inherited
from S and S+ :
diag(x) preserves the storage mode of x for 'complex' and
'double' precision, but converts integer and logicals to double :
> storage.mode(x <- 1i + 1:7);
2015 May 13
1
Why is the diag function so slow (for extraction)?
> From: Martin Maechler <maechler at lynne.stat.math.ethz.ch>
> diag() should not work only for pure matrices, but for all
> "matrix-like" objects for which ``the usual methods'' work, such
> as
> as.vector(.), c(.)
>
> That's why there has been the c(.) in there.
>
> You can always make code faster if you write the code so it only
>
2014 Jun 23
2
Unfixed bugs in latest R-patched
A new version of pqR is now available at pqR-project.org, which fixes
several bugs that are also present in the latest R Core patch release
(r66002). A number of bugs found previously during pqR development
are also unfixed in the latest R Core release. Here is the list of
these bugs that are unfixed in r66002 (including documentation
deficiencies), taken from the pqR bug fix and documentation
2000 May 25
1
diag() (PR#555)
Full_Name: David Duffy
Version: 1.0.1
OS: Linux
Submission from: (NULL) (152.98.96.21)
Documentation for diag() states that "If x is a vector (or a
1-d array) then diag(x) returns a diagonal matrix whose diagonal
is x."
> m<-matrix(1:4,ncol=1)
> diag(m)
[1] 1
diag(as.vector(m)) gives the advertised performance.
Fix: Change documentation.
2013 Apr 09
2
Behaviors of diag() with character vector in R 3.0.0
Dear all,
According to CHANGES IN R 3.0.0:
o diag() as used to generate a diagonal matrix has been re-written
in C for speed and less memory usage. It now forces the result
to be numeric in the case diag(x) since it is said to have 'zero
off-diagonal entries'.
diag(x) does not work for character vector in R 3.0.0 any more. For example,
v <- c("a",
2003 Sep 17
2
possible bug in diag()
It concerns trival diagonal matrices:
> diag(1)
[,1]
[1,] 1
> diag(rnorm(1))
<0 x 0 matrix>
> diag(rnorm(1),nrow=1)
[,1]
[1,] 0.4843697
There's an obvious work around... but I thought it was worth notifying the
list.
Regards,
John Marsland
**********************************************************************
This is a commercial communication from
2013 May 01
1
diag() when input is a numeric scalar
Hi All,
I'm wondering why when passing a single numeric value that contains any
decimals to diag() that the value is silently coerced to a integer for
constructing an identify matrix. To me, an input like diag(5.435) seems
fairly ambiguous and is more than likely a programming mistake, since it's
not obvious that a 5x5 identity matrix should be created. I've seen some
code where other
2017 Oct 21
1
Illegal Logical Values
> On Fri, 2017-10-20 at 14:01 +0000, brodie gaslam via R-devel wrote:
> > I'm thinking of this passage:
> >
> > > Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN =
> > > -2147483648 (NA, but only if NAOK is true), and the compiled code
> > > should return one of these three values. (Non-zero values other
> > > than INT_MIN are
2011 Jul 02
1
Error when using plot in diag.panel argument of pairs
Dear Madame or Sir,I am having a problem in combining density-smoothed scatterplot matrices with a plot of kernel destiny estimations of each dimension plotted on the respective field of the diagonal.I have tried following approach using the package "sm" for the kernel density estimation, as well as "MASS" respectively:pairs(myTable[, 1:4],panel=function(x,y, ...){
1998 Sep 09
2
diag() losing dimnames
Using diag() to extract the diagonal of a matrix loses all but the first dimname
(R 0.62.3). The problem seems to be in [ ]:
>
> x <- matrix(1:9,3,3)
> dimnames(x) <- list(c("a", "b", "c"), c("a", "b", "c"))
> x
a b c
a 1 4 7
b 2 5 8
c 3 6 9
> diag(x)
a NA NA
1 5 9
> x[c(1,5,9)]
a NA NA
1 5 9
>
Paul
2016 Sep 12
0
R (development) changes in arith, logic, relop with (0-extent) arrays
>>>>> Radford Neal <radford at cs.toronto.edu>
>>>>> on Fri, 9 Sep 2016 10:29:14 -0400 writes:
>> Radford Nea:
>> > So it may make more sense to move towards consistency in the
>> > permissive direction, rather than the restrictive direction.
>>
>> > That would mean allowing matrix(1,1,1) <
2015 May 04
2
Why is the diag function so slow (for extraction)?
(I asked this question on StackOverflow
<http://stackoverflow.com/q/30035939/1191259> a short time ago; sorry if
you're seeing it again. Feel free to answer there as well if you like. The
code formatting and such on that site can be nice.)
I benchmarked matrix and vector subsetting to extract the diagonal of a
square matrix against the diag() function, and the latter lost by a wide
2015 Jun 15
0
Lack of protection bug in current R release candidate
>>>>> Radford Neal <radford at cs.toronto.edu>
>>>>> on Sat, 13 Jun 2015 17:24:04 -0400 writes:
> The current R release candidate has a lack of protect bug
> (of very long standing)
[ but not really reported, right ? ]
> with respect to the
> R_print.na_string and R_print.na_string_noquote fields of
> the static
2018 May 04
0
Proposed speedup of ifelse
Thanks Radford. I concur with all your points. I've attempted to address
the issues you raised through the github.io post. The new method appears
to be slower for test lengths < 100 and possibly longer lengths (not just <
10). Of course length(test) < 100 is very quick, so I simply added this to
the conditions that cause the old ifelse method to be invoked. I'll leave
it to
2004 Jan 12
1
Matrix indexes
Two questions about matrix indexing:
Is is correct that V <- V[lower.tri(V, diag=TRUE)] returns the lower
triangular of matrix V, that is: all elements above diagonal are set to zero? I
understand that the triangle of matrix elements of V for which lower.tri is
TRUE are returned while the others (above diagonal) are set to zero (or NA ???).
If D and B are vectors of logicals,
what
2010 Jan 07
1
"diag", "diag<-" and "[" , "[<-"
Dear all
I have the following problem.
M <- matrix(0,3,3) # dimension of M is dinamic and this can lead to the
next subscript
diag(M[1,1]) <- rep(100,1)
#Error in `diag<-`(`*tmp*`, value = 100) :
# only matrix diagonals can be replaced
diag(M[1,1,drop=F]) <- rep(100,1)
#Error in diag(M[1, 1, drop = F]) <- rep(100, 1) :
# incorrect number of subscripts
diag(M[2:3,1:2]) <-
2016 Sep 12
1
R (development) changes in arith, logic, relop with (0-extent) arrays
> > But isn't the intent to make it an error later? So I assume we're
> > debating making it an error, not just a warning.
>
> Yes, that's correct.
> But if we have a longish deprecation period (i.e. where there's
> only a warning) all important code should have been adapted
> before it turns to an error
That might be true for
2010 Oct 18
1
make error for R 2.13.0 (and 2.12.0)
Regarding Tengfei Yin's post about an error trying to install
"cluster" in 2.13.0, I have gotten an error with this package when
trying to install the released version of 2.12.0. Here is the output
on an Ubuntu Linux system:
begin installing recommended package cluster
* installing *source* package 'cluster' ...
** libs
make[3]: Entering directory
2015 Jul 15
1
Two bugs showing up mostly on SPARC systems
On Tue, Jul 14, 2015 at 07:52:56PM -0400, Duncan Murdoch wrote:
> On 14/07/2015 6:08 PM, Radford Neal wrote:
> > In testing pqR on Solaris SPARC systems, I have found two bugs that
> > are also present in recent R Core versions. You can see the bugs and
> > fixes at the following URLs:
> >
> >
2015 Jul 14
0
Two bugs showing up mostly on SPARC systems
On 14/07/2015 6:08 PM, Radford Neal wrote:
> In testing pqR on Solaris SPARC systems, I have found two bugs that
> are also present in recent R Core versions. You can see the bugs and
> fixes at the following URLs:
>
> https://github.com/radfordneal/pqR/commit/739a4960a4d8f3a3b20cfc311518369576689f37
Thanks for the report. Just one followup on this one:
There are two sections