MathGroup Archive 2006

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

Search the Archive

Re: Numerical evaluation is Mathematica bottleneck?!

  • To: mathgroup at
  • Subject: [mg69066] Re: Numerical evaluation is Mathematica bottleneck?!
  • From: Oliver Ruebenkoenig <ruebenko at>
  • Date: Tue, 29 Aug 2006 03:26:02 -0400 (EDT)
  • References: <ecrasb$p3o$>
  • Sender: owner-wri-mathgroup at

Dear Gregor,

It is difficult to give a definite answer since you do not give the exact 
problem. Here are some _thoughts_ on the problem.

> I am solving a non-linear semiconductor PDE problem with finite 
> difference discretization. The Compiled algebraic equation and its 
> Jacobian  take as input central point and two adjacent neighbors and 
> they are Threaded over the whole mesh. A LinearSolve and some damping 
> schemes are used to obtain next step towards the solution. Typical mesh 
> is about 300 points and the solution is usually found in 7 iterations, 
> which takes about 7 seconds of computational time.This is already too 
> slow, but since I plan to solve the problem in 2D this is much too 
> slow!!! The bottleneck is the numerical evaluation of the compiled 
> equation and its Jacobian. I am thinking of using MathLink and write the 
> numerical evaluation routine in C++, which would take a list of data and 
> return evaluated function and the Jacobian.

OK, you might want to look at the finite element operators i have 

And some examples which can be found here:

(Maybe the Navier-Stokes one is interesting for you since it is 

An important step will be the linearization which can be done 
symbolically. See:

This will give you the input to the finite element (or any other PDE 
discretization method) operators. The point here is that you do the 
linearization once and feed the operators with the old state variable 
until convergence has been reached. 

> Is this the right way? Could the link itself be a timing bottleneck? Any 
> other suggestions?

MathLink is good if you can write out all the data _one_ compute in C and 
read back _once_. If you do lots of interaction. If might loose to much 
performance. I have done a thorough analysis of MathLink for Mathematica 
Version 4. You can have a look at it:

Does this help????


Oliver Ruebenkoenig, <ruebenko at>
   Phone: ++49 +761 203 7388

  • Prev by Date: Minor gripe re Table formatting
  • Next by Date: Is -1^(2/5) really undefined in R?
  • Previous by thread: Re: Numerical evaluation is Mathematica bottleneck?!
  • Next by thread: Re: Re: Numerical evaluation is Mathematica bottleneck?!