Displaying 20 results from an estimated 1620 matches for "diags".
Did you mean:
diag
2018 Sep 17
3
diag(-1) produces weird result
Dear list
A strange bug in the psych package is due to the behavior of the diag function:
It gives the expected values for 1, a vector (-1,1), but not for -1
Is this a known feature?
> diag(1)
[,1]
[1,] 1
> diag(c(-1,1))
[,1] [,2]
[1,] -1 0
[2,] 0 1
> diag(-1)
Error in diag(-1) : invalid 'nrow' value (< 0)
Bill
William Revelle
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]) <-
2012 May 26
2
[PATCH] Update diag/mbr instruction to match the current filename.
From: Jean-Christian de Rivaz <jc at eclis.ch>
I suspect that some instructions about how to use the diag/mbr was not
updated when the source file was renamed to handoff.S. Here is a simple
proposition to fix that.
Jean-Christian de Rivaz
---
diag/mbr/README | 4 ++--
diag/mbr/handoff.S | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/diag/mbr/README
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",
2012 Jun 07
2
How to build a large identity matrix faster?
Hello, I am trying to build a large size identity matrix using diag(). The
size is around 23000 and I've tried diag(23000), that took a long time.
Since I have to use this operation several times in my program, the running
time is too long to be tolerable. Are there any alternative for diag(N)?
Thanks
Cheers,
yct
[[alternative HTML version deleted]]
2006 Nov 05
1
diag()<- in Matrix?
Dear all,
I am trying to use the Matrix package to do some calculations on rather
large and sparse matrices. An example of such a matrix is given below.
mig<-0.2
side<-10
np<-side^2
mig.mat<-matrix(0,np,np)
diag(mig.mat[1:(np-side),(side+1):np])<-mig/4
diag(mig.mat[(side+1):np,1:(np-side)])<-mig/4
diag(mig.mat[-np,-1])<-mig/4
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);
2009 Sep 04
5
< 0 x 0 matrix >
Hi,
Does anybody know, what is going on here?
> diag(sqrt(1))
[,1]
[1,] 1
> diag(sqrt(0.3333))
<0 x 0 matrix>
> sqrt(1)
[1] 1
> sqrt(0.3333)
[1] 0.5773214
BR, Markku Karhunen
researcher
University of Helsinki
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
2003 May 08
3
Avoiding loops to spare time and memory
Is it possible to avoid the loop in the following function (or make the
function otherwise more efficient) and can someone point me to a
possible solution? (It would be great if hours could be reduced to
seconds :-).
# ---------------------------------------------
RanEigen=function(items=x,cases=y,sample=z)
{
X=matrix(rnorm(cases*items),nrow=cases,byrow=F)
S=crossprod(X-rep(1,cases) %*%
2007 May 03
1
perl-Mail-SPF Package Missing Dependency
I was spamassassin update
spamassassin.i386 0:3.2.0-1.el4.rf
Complete!
and then,Require Perl-Package installed
[30998] dbg: diag: module not installed: Mail::SPF ('require' failed)
[30998] dbg: diag: module installed: Mail::SPF::Query, version 1.999001
[30998] dbg: diag: module installed: IP::Country::Fast, version 604.001
[30998] dbg: diag: module installed: Razor2::Client::Agent,
2004 Nov 26
1
Namespaces, coercion and setAs
I'm trying to resolve a small problem that has arisen from introducing a
NAMESPACE for the package SparseM. Prior to the namespace I had
a class "matrix.diag.csr" that consisted of diagonal sparse matrices.
It
was defined to have the same attributes as the matrix.csr class and
setAs
was used to define how to coerce integers and vectors into this form:
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
>
2018 Dec 18
1
[PATCH] virtio-ccw: diag 500 may return a negative cookie
If something goes wrong in the kvm io bus handling, the virtio-ccw
diagnose may return a negative error value in the cookie gpr.
Document this.
Signed-off-by: Cornelia Huck <cohuck at redhat.com>
---
Even if the virtio spec is the correct place to specify what diag 500
subcode 3 does, we also should mention here that the cookie may be
an error.
---
2006 Oct 03
4
how ot replace the diagonal of a matrix
Dear useRs,
Trying to replace the diagonal of a matrix is not working for me. I
want a matrix with .6 on the diag and .4 elsewhere. The following
code looks like it should work--when I lookk at mps and idx they look
how I want them too--but it only replaces the first element, not each
element on the diagonal.
mps <- matrix(rep(.4, 3*3), nrow=n, byrow=TRUE)
idx <- diag(3)
mps
idx
mps[idx]
2012 Dec 11
1
converting manual command to loop command
Dear useRs,
i have certain commands for some operations in R. They are good if you have a small dataset but my dataset, apart from what i used in the recent past, is prety large. I want to convert these massive sets of commands into a simple loop.
Your help is required on it
thanks in advance
eliza
kindly note:
"e" is matrix whose each column has to be executed into a distance vector
2015 May 13
1
Why is the diag function so slow (for extraction)?
As kindly pointed out to me (oh my decaying gray matter), is.object()
is better suited for this test;
$ svn diff src/library/base/R/diag.R
Index: src/library/base/R/diag.R
===================================================================
--- src/library/base/R/diag.R (revision 68345)
+++ src/library/base/R/diag.R (working copy)
@@ -23,9 +23,11 @@
stop("'nrow' or
2018 Sep 17
2
diag(-1) produces weird result
On Mon, Sep 17, 2018 at 5:22 PM, G?bor Cs?rdi <csardi.gabor at gmail.com>
wrote:
> I would say it is a mis-feature. If the 'x' argument of diag() is a
> vector of length 1, then it creates an identity matrix of that size,
> instead of creating a 1x1 matrix with the given value:
>
> ? diag(3)
> [,1] [,2] [,3]
> [1,] 1 0 0
> [2,] 0 1 0
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
2011 Nov 14
2
Re: OpenGL issues on OSX (wine 1.3.21)
Hi James,
thank you for your kind reply. The XQuartz folks recommend to logout and back in to have the DISPLAY variable set correctly, which I did. But I will also try a reboot to be sure.
When I start something with wine, the XQuartz icon comes up automatically, so I am pretty sure that XQuartz is used (Apple's X11 is not active).
I had another try with WINEDEBUG=+wgl, perhaps that brings