[R] problem with matrix multiplication
Marlene Mueller
marlene.mueller at gmx.de
Fri May 25 11:43:49 CEST 2001
Thanks for all solutions! The most elegant & efficient way
seems to me t(t(X)*Y) or t(Y*t(X)). Marlene
Marlene Mueller wrote:
>
> Hi, I look for a solution to the following problem:
>
> I have a (n x p) matrix X and a (p x 1) vector Y which
> are to be multiplied such the result is the (n x p) matrix
>
> Z = ( X[,1]*Y[1] .... X[,p]*Y[p] )
>
> Up to now I found that sweep(X,2,Y,"*") is (almost) what
> I want, but only for p>1.
>
> Is there another elegant way to do this by matrix
> operations -- including the case p=1?
>
> --
> Marlene Mueller
> http://www.uni-bayreuth.de/departments/math/org/mathe7/Mueller.html
> http://ise.wiwi.hu-berlin.de/~marlene
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help 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-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Marlene Mueller
http://www.uni-bayreuth.de/departments/math/org/mathe7/Mueller.html
http://ise.wiwi.hu-berlin.de/~marlene
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list