Hi Martin,

I followed your example on my set  of data. Which has non zero values in
300k positions in 22638 X 80914 sparse matrix. I am able to load data into a
field and was able to do some operations (essentially  t(m) %*% m). However,
when I tried to display the value in the resulted matrix. I am getting below
error
*
Error in asMethod(object) :
  Cholmod error 'out of memory' at file:../Core/cholmod_memory.c, line 148*

The sequence of commands I used are:

>uac=read.table('C:\\personal\\code\\data\\user_album_count.csv',sep=',' ,
header=T)
>library(Matrix)
>m<-sparseMatrix(i=uac[,"user"],j=uac[,"item"],x=uac[,"count"])
>cm<-t(m) %*% m
upto this point, I was able to run, however when I tried to display cm[1,1],
I got above error. Kindly let me know if there is anything wrong going on
here.

Thanks
Pallavi

On Tue, Oct 27, 2009 at 8:34 PM, Martin Maechler <maech...@stat.math.ethz.ch
> wrote:

> >>>>> "PP" == Pallavi P <pallavip...@gmail.com>
> >>>>>     on Tue, 27 Oct 2009 18:13:22 +0530 writes:
>
>    PP> Hi Martin,
>    PP> Thanks for the help. Just to make sure I understand correctly.
>
>    PP> The below steps are for creating an example table similar to the one
> that I
>    PP> read from file.
>
> yes, exactly
>
>     n <- 22638
>     m <- 80914
>     nnz <- 300000 # no idea if this is realistic for you
>
>     set.seed(101)
>     ex <- cbind(i = sample(n,nnz, replace=TRUE),
>     j = sample(m,nnz, replace=TRUE),
>     x = round(100 * rnorm(nnz)))
>
>
>     PP> and I can understand the way sparseMatrix is initialized right now
> as
>     M <- sparseMatrix(i = ex[,"i"],
>                      j = ex[,"j"],
>                      x = ex[,"x"])
>
>     PP> How ever, I couldn't understand the use of below commands.
>
>   MM. <- tcrossprod(M) # == MM' := M %*% t(M)
>   M.1 <- M %*% rep(1, ncol(M))
>   stopifnot(identical(drop(M.1), rowSums(M)))
>
> They were just for illustrative purposes,
> to show how and that you can work with the created sparse matrix
> 'M'.
>
> Regards,
> Martin Maechler, ETH Zurich
>
>    PP> Kindly let me know if I missed something.
>
>    PP> Thanks
>    PP> Pallavi
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to