>>>>> "GC" == Gray Calhoun <[email protected]>
>>>>> on Mon, 14 Dec 2009 19:26:44 -0600 writes:
GC> Check out crossprod and the Matrix package (capitalized); there's also
GC> a discussion of their speed gains in the R newsletter that should turn
GC> up with a search and in the vignette as well.
Yes, use the 'Matrix' package.
For the problem you mention, X being a "design matrix" of
regression problem,
you may be interested in the sparse.model.matrix() function
which constructs such a sparse X from a formula and a data
frame.
With
> library(Matrix)
> example(sparse.model.matrix)
you get a few (small sample) examples.
Martin Maechler, ETH Zurich
GC> -Gray
GC> On Monday, December 14, 2009, parkbomee <[email protected]> wrote:
>>
>>
>> Hi all,
>>
>> Is there a way to do a matrix multiplication in a faster way?
>> I am making a product of a matrix (composed of a lot of dummy variables)
and a vector, and is there any way to make it faster?
>> The simple X %*% y takes too long a time.
>> I know using sparse matrix would help, but don't know how to do it i R.
>>
>>
>> Thank you.
______________________________________________
[email protected] 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.