Dear Duncan
Thanks for your suggestion, but I really need sparse matrices: I have
implemented various graph algorithms based on adjacency matrices. For large
graphs, storing all the 0's in an adjacency matrices become uneconomical, and
therefore I thought I would use sparse matrices but the
Duncan,
I should probably add that I am aware that my code is not the solution and also
that the relative gain of my code probably decreases with the problem size
until eventually it will perform worse that [i,j] (because of copying I
suppose). So my point is just: It would just be nice if
On 12-06-24 4:50 PM, Søren Højsgaard wrote:
Dear all,
Indexing matrices from the Matrix package with [i,j] seems to be very slow. For
example:
library(rbenchmark)
library(Matrix)
mm- matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20)
MM- as(mm, Matrix)
lookup- function(mat){
for (i in
Dear all,
Indexing matrices from the Matrix package with [i,j] seems to be very slow. For
example:
library(rbenchmark)
library(Matrix)
mm - matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20)
MM - as(mm, Matrix)
lookup - function(mat){
for (i in 1:nrow(mat)){
for (j in 1:ncol(mat)){
4 matches
Mail list logo