MathGroup Archive 2000

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

Search the Archive

speed of evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26178] speed of evaluation
  • From: "Bernd Ebersberger" <bernd.ebersberger at wiso.uni-augsburg.de>
  • Date: Thu, 30 Nov 2000 01:04:18 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

dear all,

i have a problem with the speed of mathematica 4.0

i have function f that is a list and it contains several (more than 200)
functions as elements. a simple example is attached at  the end of the
mail - the functions, i deal with are much more complex than the ones in the
example here.

the functions depend on more than 40 variables althouhg it's only three in
the example.

f[{x1_,x2_, ... x40_,x41_ ...}]

then i have a dataset containing about 600 datapoints for the {x1_,x2_, ...
x40_,x41_ ...} variables (in the list dataEx in the example just randomly
created) and i have a target value for each datapoint (in the list dataEnd
in the example also randomly created in the example)

what i want to do is evaluate each function in the function-list f on each
datapoint and compute the sum of the squared distances to the target values.

i do that with:

****************************** example
********************************************

dataEx = Table[{Random[], Random[], Random[]}, {600}];
dataEnd = Table[Random[], {600}];
f[{x1_, x2_, x3_}] := {x1^2 + x3^0.5, x1, x2, 3 x3/(1 + x1), x3 5 x2^(x3/4),
    x1 + x2 + x3, x3 - x2*x2, x1^2}
popSize = Length[f[{x1, x2, x3}]];
res1 =
    Re[Plus @@
        Map[Map[#^2 &, #] &,
          N[Map[(Table[1, {popSize}]*#) &, Flatten[dataEnd]] -
              Map[f, dataEx]]]]

****************************************************************************
*******

the problem is that the evaluation of that number of functions (200
functions) on 600 datapoints containing 40 and more variables takes quite a
while. as i have to repeat that process for a couple of houndred times (f
changes from run to run!!!) this ads up.


does anybody have a suggestion how to speed up the process?


kind regards



bernd.



  • Prev by Date: Re: Function compile problems
  • Next by Date: Re: Equivalent functions generate different plots
  • Previous by thread: What is legal for :ReturnType:
  • Next by thread: Re: speed of evaluation