       Re: column * row ??

• To: mathgroup at smc.vnet.net
• Subject: [mg28847] Re: column * row ??
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Tue, 15 May 2001 00:59:21 -0400 (EDT)
• References: <rnIL6.7917\$UE4.54583@ralph.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Some timing info:

v= Table[Random[],{500}];
w=Table[Random[],{1000}];

xx=Outer[Times,v,w];//Timing

{14.45 Second,Null}

yy=(List/@v).{w};//Timing

{1.82 Second,Null}

xx===yy

True

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

<BobHanlon at aol.com> wrote in message
news:rnIL6.7917\$UE4.54583 at ralph.vnet.net...
> n = 5;
> colvec = Table[ToExpression["a"<>ToString[k]], {k, n}];
> rowvec = Table[ToExpression["b"<>ToString[k]], {k, n}];
>
> Outer[Times, colvec, rowvec]
>
> Bob Hanlon
>
> In a message dated 2001/5/12 9:50:46 PM, jrchaff at mcn.net writes:
>
> >Can someone tell me a way to mimic the building of
> >an N x N matrix by multiplying a column vector
> >on left times a row vector on right ? (both vectors
> >of length N) - I mean in Mathematica, of course.
> >
> >i.e, want the result,
> >
> >(colvec){a1,a2, .. aN} * (rowvec){b1,b2,..bN} =
> >
> >result is matrix:
> >
> >{{a1*b1  a1*b2 .....  a1*bN},
> > {a2*b1  a2*b2 .....  a2*bN},
> >  ...     ...          ...  ,
> > {aN*b1  aN*b2 .....  aN*bN}}
> >
> >
> >When I try this in Mathematica all I can figure out
> >how to produce is the standard dot-product.  If I
> >try the 'transposed' lists/matrices, I get an error,
> >even tho the product is defined by basic rules of
> >matrix multiplication.
> >
>
>

```

• Prev by Date: Re: column * row ??(2)
• Next by Date: Re: RE: column * row ??
• Previous by thread: Re: column * row ??
• Next by thread: Re: Decimal math bug?