I see, now I got it.
and thanks for the example with matrix.
best
alessia
2010/1/12 Martin Maechler <maechler at
stat.math.ethz.ch>:>>>>>> "am" == alessia matano <alexis.rtd at
gmail.com>
>>>>>> ? ? on Mon, 11 Jan 2010 16:20:57 +0100 writes:
>
> ? ?am> Many thanks for it.
> ? ?am> However it is strange that when I put the numbers rather than
ncol(R)
> ? ?am> (a matrix with ncol=36698) it worked. Look below
>
> ? ?>> dim(res2)
> ? ?am> [1] 170471 ?25822
> ? ?>> D<- as.matrix.csr(0,nrow(tmpb),25822)
> ? ?>> D<- as.matrix.csr(0,nrow(tmpb),ncol(res2))
> ? ?am> Error in if (length(x) == nrow * ncol) x <- matrix(x, nrow,
ncol) else { :
> ? ?am> missing value where TRUE/FALSE needed
> ? ?am> In addition: Warning message:
> ? ?am> In nrow * ncol : NAs produced by integer overflow
>
> ? ?am> But probably it is true what you said, anyway.
>
> yes, it is true.
> The clue is that ?typeof(25822) ? is "double" and not
"integer".
>
> ? ?am> So, do you suggest me to use directly the simple matrix command?
or a
> ? ?am> kind of sparse matrix within your package?!?
>
> the latter, e.g.,
>
> ?library(Matrix)
> ?D <- Matrix(0, nrow = 113289, ncol=36698)
> ?## or
> ?D. <- sparseMatrix(x=double(0), i=integer(0), j=integer(0),
> ? ? ? ? ? ? ? ? ? ?dims = c(113289,36698))
> ?identical(D, D.) ##--> TRUE
>
> ## and, e.g.,
>
>> Dk <- kronecker(D, Diagonal(x=5:2))
>> identical(Dk, D %x% Diagonal(x = 5:2))
> [1] TRUE
>> dim(D)
> [1] 113289 ?36698
>> dim(Dk)
> [1] 453156 146792
>>
>
> Regards,
> Martin Maechler, ETH Zurich
>