Displaying 20 results from an estimated 1620 matches for "diag".
Did you mean:
dag
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 Revell...
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]) <- rep(100,2)
# works fine
Is there a way...
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 b/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 mo...
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
nomig<-which(1:(side^2-1)%%side==0)
diag(mig.mat[-np,-1])[nomig]<-0
diag(mig.mat[-1,-np])<-mig/4
diag(mig.mat[-1,-np])[nomig]<-0
diag(mig.mat)<-1...
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); storage.mode(diag(x))
[1] "...
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
************************************...
2003 May 08
3
Avoiding loops to spare time and memory
...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) %*% t(colMeans(X)))
EV=eigen((1/sqrt(diag(S))*diag(items))%*%S%*%(1/sqrt(diag(S))*diag(items)),only.values=T)$values
for (i in 2:sample)
{
X=matrix(rnorm(cases*items),nrow=cases,byrow=F)
S=crossprod(X-rep(1,cases) %*% t(colMeans(X)))
EV=rbind(EV,eigen((1/sqrt(diag(S))*diag(items))%*%S%*%(1/sqrt(diag(S))*diag(items)),only.values=T...
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, version 2.82
[30998] dbg: diag: mod...
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:
setClass("matrix.diag.csr","matrix.csr")
setAs("numeric","...
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 co...
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.
---
Documenta...
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,...
2012 Dec 11
1
converting manual command to loop command
...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
##To get a distance matrix
>a<-dist(e[,1], upper=TRUE, diag=TRUE)
##To convert it in a matrix
>a<-matrix(a, ncol=1)
>b<-dist(e[,2], upper=TRUE, diag=TRUE)
>b<-matrix(b, ncol=1)
>c<-dist(e[,3], upper=TRUE, diag=TRUE)
>c<-matrix(c, ncol=1)
>d<-dist(e[,4], upper=TRUE, diag=TRUE)
>d<-matrix(d, ncol=1)...
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 'ncol' cannot be specified when...
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
> [3,] 0 0 1
>
> Of course this makes it cumb...
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...
2011 Nov 14
2
Re: OpenGL issues on OSX (wine 1.3.21)
...ontext (0x58c)
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:X11DRV_wglCreateContext (0x58c)->(PF:81)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
DIAG: apple_glx_create_context: ac 0x40464da0 ac->context_obj 0x4085d800
trace:wgl:X11DRV_wglCreateContext creating context 0x30de568 (GL context creation delayed)
trace:wgl:X11DRV_GetPixelFormat (0x12a228)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:Conv...