Preventing unwanted threading by Inner
- To: mathgroup at smc.vnet.net
- Subject: [mg123428] Preventing unwanted threading by Inner
- From: Chris Young <cy56 at comcast.net>
- Date: Wed, 7 Dec 2011 06:13:39 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I'm trying to prevent Inner from expanding my points into coordinates: In[283]:= Inner[Times, {a, b, c}, {{A, α}, {B, β}, {C, Ï?}}, Plus] Out[283]= {a A + b B + c C, a α + b β + c Ï?} As I understand it, this has to do with Times being Listable: In[304]:= Attributes[Times] Out[304]= {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected} But clearing the listable attribute doesn't do anything: Unprotect[Times]; ClearAttributes[Times, Listable]; myInnnerProd = Inner[Times, {a, b, c}, {{A, α}, {B, β}, {C, Ï?}}, Plus]; SetAttributes[Times, Listable]; Protect[Times]; In[315]:= myInnnerProd Out[315]= {a A + b B + c C, a α + b β + c Ï?} In addition, I have to resort to using Hold on the points. Not sure why; I would have thought that making Times non-listable would have been enough. In[343]:= Unprotect[Times]; ClearAttributes[Times, Listable]; myInnerProd = Inner[Times, {a, b, c}, Hold /@ {{A, α}, {B, β}, {C, Ï?}}, Plus]; myInnnerProd = ReleaseHold[myInnerProd] SetAttributes[Times, Listable]; Protect[Times]; Out[346]= a {A, α} + b {B, β} + c {C, Ï?}
- Follow-Ups:
- Re: Preventing unwanted threading by Inner
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: Preventing unwanted threading by Inner
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Preventing unwanted threading by Inner