Thanks everyone,
That's a 3000 fold speedup. Now if only I can get the same improvement on
the stMincuts iGraph algorithm.
On Fri, Apr 25, 2014 at 4:20 AM, Martin Maechler wrote:
> > Stefan Evert
> > on Fri, 25 Apr 2014 09:09:31 +0200 writes:
>
> > On 24 Apr 2014, at 23:56, G
> Stefan Evert
> on Fri, 25 Apr 2014 09:09:31 +0200 writes:
> On 24 Apr 2014, at 23:56, Greg Snow <538...@gmail.com> wrote:
>> library(Matrix)
>>
>> adjM <- Matrix(0,nrow=10,ncol=10)
>>
>> locs <- cbind( sample(1:10), sample(1:10) )
>> vals <- rnorm(10)
On 24 Apr 2014, at 23:56, Greg Snow <538...@gmail.com> wrote:
> library(Matrix)
>
> adjM <- Matrix(0,nrow=10,ncol=10)
>
> locs <- cbind( sample(1:10), sample(1:10) )
> vals <- rnorm(10)
>
> adjM[ locs ] <- vals
... and once you've got your data in this format, why not construct the sparse
ma
Convert your 'targets' matrix into a 2 column matrix with the 1st
column representing the row and the 2nd the column where you want your
values, then change the values to a single vector and you can just use
the targets matrix as the subsetting in 1 step without (explicit)
looping, for example:
li
I need to generate a sparse matrix. Currently I have the data held in two
regular matrices. One 'targets' holds the column subscripts while the other
'scores' holds the values. I have written a 'toy' sample below. Using this
approach takes about 90 seconds to populate a 3 x 3 element matrix
5 matches
Mail list logo