[Rd] Thought on crossprod

Jonathan Rougier J.C.Rougier@durham.ac.uk
Mon, 18 Mar 2002 08:51:35 +0000


ripley@stats.ox.ac.uk wrote:
> 
> On Fri, 15 Mar 2002, Thomas Lumley wrote:
> 
> > On Fri, 15 Mar 2002, Martin Maechler wrote:
> >
> > > >>>>> "JonR" == Jonathan Rougier <J.C.Rougier@durham.ac.uk> writes:
> > >
> > >     JonR> does not recognise the case where y is the same as x as special.  I'd
> > >     JonR> like to extend crossprod to something like
> > >
> > >     >> crossprod
> > >     JonR> function(x, y = NULL)
> > >     JonR> if (is.null(y))
> > >     JonR>    .Internal(crossprod.symm(x))
> > >     JonR> else
> > >     JonR>    .Internal(crossprod(x, y))
> > >
> > >     JonR> Before I start mesing up my R-1.4.1 installation, does anyone have any
> > >     JonR> thoughts on this?
> > >
> > > Just for clarification:
> > > The main point of your suggestion is to pass only half as much
> > > data down to C, right?
> > >
> >
> > If this can be done with the BLAS functions then halving the necessary
> > memory bandwidth will also help -- that's one of the limiting factors in
> > ATLAS, for example.
> 
> Looks like dsyrk can do this: despite the definition of *sy* BLAS routines
> on my quick reference card it does not need a symmetric matrix, which is
> why I overlooked it in earlier correspondence with Jonathan.  As from
> 1.5.0 dsyrk will be available in R.

Sorry -- I've been away for the weekend.  My intention in the original
post was not to save on memory but simply to do half as many
inner-products (it seems inelegant not to exploit the symmetry!).  I had
not thought about losing the benefit of an optimised BLAS (I am not
using one myself at present).  I take it from this correspondence that,
for now, my best approach might be to write my own "crossprod.symm" in
C, but that this might actually slow me down in the future.

Cheers, Jonathan.

-- 
Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._