that makes sense, thanks for the reply
On 13 June 2012 05:53, Uwe Ligges wrote:
>
>
> On 11.06.2012 11:45, Ceci Tam wrote:
>
>> diag(n) is alright when n = 5e3, it took 0.7 sec on my machine for
>> diag(5e3). However, it's slow when n = 23000, diag(23000) took 15 sec
>>
>
>
> 1. As others have s
On 11.06.2012 11:45, Ceci Tam wrote:
diag(n) is alright when n = 5e3, it took 0.7 sec on my machine for
diag(5e3). However, it's slow when n = 23000, diag(23000) took 15 sec
1. As others have said already, for huge data, the Matrix implementation
for diagonals is the right idea, since it ac
diag(n) is alright when n = 5e3, it took 0.7 sec on my machine for
diag(5e3). However, it's slow when n = 23000, diag(23000) took 15 sec
On 11 June 2012 17:43, Ceci Tam wrote:
> diag(n) is alright when n = 5e3, it took 0.7 sec on my machine for
> diag(5e3). However, it's slow when n = 23000, dia
On Fri, Jun 8, 2012 at 5:31 PM, R. Michael Weylandt
wrote:
> For the matter and hand, you can probably get to it by simply trying
> base:::diag. In this case, it's not too hard because what you're
> seeing is the S4 generic that the Matrix package is defining _over_
> the regular base function gen
For the matter and hand, you can probably get to it by simply trying
base:::diag. In this case, it's not too hard because what you're
seeing is the S4 generic that the Matrix package is defining _over_
the regular base function generic.
More generally, going down the rabbit hole of S4:
As it sugg
How can one get the source code for diag? I tried the following:
> diag
standardGeneric for "diag" defined from package "base"
function (x = 1, nrow, ncol)
standardGeneric("diag")
Methods may be defined for arguments: x, nrow, ncol
Use showMethods("diag") for currently available ones.
I quickly looked at it, and the difference comes from:
n <- 5e3
system.time(x <- array(0, c(n, n))) # from diag()
system.time(x <- matrix(0, n, n)) # from Rdiag()
Replaced in R-devel.
Best,
Uwe Ligges
On 07.06.2012 12:11, Spencer Graves wrote:
On 6/7/2012 2:27 AM, Rui Barradas wrote:
Hel
On 6/7/2012 2:27 AM, Rui Barradas wrote:
Hello,
To my great surprise, on my system, Windows 7, R 15.0, 32 bits, an R
version is faster!
I was also surprised, Windows 7, R 2.15.0, 64-bit
> rbind(diag=t1, Rdiag=t2, ratio=t1/t2)
user.self sys.self elapsed user.child sys.child
diag
Em 07-06-2012 11:26, Prof Brian Ripley escreveu:
On 07/06/2012 10:27, Rui Barradas wrote:
Hello,
To my great surprise, on my system, Windows 7, R 15.0, 32 bits, an R
version is faster!
Faster than what? diag() is written entirely in R, just more general
than yours and so one would expect it
On 07/06/2012 10:27, Rui Barradas wrote:
Hello,
To my great surprise, on my system, Windows 7, R 15.0, 32 bits, an R
version is faster!
Faster than what? diag() is written entirely in R, just more general
than yours and so one would expect it to be slower.
I have to say that we don't see a
Hello,
To my great surprise, on my system, Windows 7, R 15.0, 32 bits, an R
version is faster!
Rdiag <- function(n){
m <- matrix(0, nrow=n, ncol=n)
m[matrix(rep(seq_len(n), 2), ncol=2)] <- 1
m
}
Rdiag(4)
n <- 5e3
t1 <- system.time(d1 <- diag(n))
t2 <- system.time(d2
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)?
Tha
12 matches
Mail list logo