Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: How do I DistributeDefinitions inside a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97805] Re: How do I DistributeDefinitions inside a function?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sun, 22 Mar 2009 05:47:42 -0500 (EST)
  • References: <gq2f1b$ef9$1@smc.vnet.net>

Hi,

and

LeaveOneOut[f_Symbol, items_] := (
   SetSharedFunction[f];
   Parallelize[
    MapIndexed[
     f[#1, items[[Complement[Table[i, {i, Length[items]}], #2]]]] &,
     items]])
?

does not help.

Regards
   Jens

uk.org.microserf at googlemail.com wrote:
> Hi
> 
> I have the following function:
> 
> LeaveOneOut[f_, items_] :=
> Parallelize[
>   MapIndexed[
>    f[#1, items[[Complement[Table[i, {i, Length[items]}], #2]]]] &,
>    items]]
> 
> Which might be called as follows:
> 
> a = 10 Table[i, {i, 10}];
> f[x_, items_] := Mean[items] + x;
> DistributeDefinitions[a, f];
> LeaveOneOut[f, a]
> 
> Notice that I need to explicitly call DistributeDefinitions. I would
> like to modify LeaveOneOut such that it performs the
> DistributeDefinitions call. I've tried a few things=97such as using
> (Distribute....; Parallelize...) and Module[{}, Distribute....;
> Parallelize...]=97but the arguments passed to LeaveOneOut don't seem to
> be being distributed (old definitions are used instead). I'm a
> relative Mathematica novice, so help=97and an explanation of why what I
> have already tried doesn't work=97would very much be appreciated!
> 
> Cheers
> 
> Chris
> 


  • Prev by Date: Re: Compress timing with different data types
  • Next by Date: Re: Online Graphic Output
  • Previous by thread: How do I DistributeDefinitions inside a function?
  • Next by thread: Re: How do I DistributeDefinitions inside a function?