MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Preventing unwanted threading by Inner

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123463] Re: Preventing unwanted threading by Inner
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 8 Dec 2011 05:24:09 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112071113.GAA04136@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

You never told us specifically what you WANT the result to be. Your last  
posted result? Maybe, but I'm not sure how useful it will be with all  
those Hold

Not this, I'm guessing:

{a, b, c} * {{A, \[Alpha]}, {B, \[Beta]}, {C, \[Chi]}}

{{a A, a \[Alpha]}, {b B, b \[Beta]}, {c C, c \[Chi]}}

Bobby

On Wed, 07 Dec 2011 05:13:39 -0600, Chris Young <cy56 at comcast.net> wrote:

> 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, ��}
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: 100 rows and 100 columns random matrix
  • Next by Date: Crashing problem with 3d IFS program
  • Previous by thread: Preventing unwanted threading by Inner
  • Next by thread: Re: Preventing unwanted threading by Inner