Re: Multiplying a vector over multiple vectors
- To: mathgroup at smc.vnet.net
- Subject: [mg91175] Re: [mg91150] Multiplying a vector over multiple vectors
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Fri, 8 Aug 2008 07:15:38 -0400 (EDT)
- References: <200808070842.EAA02140@smc.vnet.net>
On Aug 7, 2008, at 4:42 AM, Donald DuBois wrote: > How does one get a vector to distribute over > a list of vectors under multiplication? > > For example: > > {{1,2}, {3,4}, {5,6}} times {a,b} should > equal (under this operation) > > {{a, 2b}, {3a, 4b}, {5a, 6b}} > > If {a,b} is duplicated three times one can > use MapThread as in: > > MapThread[Times, {{{1, 2}, {3, 4}, {5, 6}}, {{a, b}, {a, b}, {a, b}}}] > > but duplicating {a,b} using Table is very slow > when the vectors are large (consisting of thousands > of elemets). You can just use Map {a,b} #&/@{{1,2},{3,4},{5,6}}
- References:
- Multiplying a vector over multiple vectors
- From: Donald DuBois <donabc@comcast.net>
- Multiplying a vector over multiple vectors