MathGroup Archive 2002

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

Search the Archive

Re: Arbitrary Crash with Compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36541] Re: Arbitrary Crash with Compile
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 11 Sep 2002 13:27:19 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <alev2a$5dm$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

my Mathematica 4.2 does not crash and you may upgrade
your version.

Regards
  Jens

Wizard Lab wrote:
> 
> Dear Group,
> 
> I have a  program to take the local polynomial non parametric regression
> of two variables.  It uses Compile, unfortunately, and regularly, but
> inconsistently, causes Mathematica to crash (in Win2K, with I forget
> what error, and in Win98/Mathematica4.0 with an invalid memory access from
> MathDLL.dll).  I am running Mathematica 4.1, and have this problem consistently
> on 4 different machines.
> 
> Here is the code, if it doesn't crash the first time, it will the second
> or third:
> 
> (*
> w = Compile[{{xj, _Real, 0}, {XX, _Real, 1}, {YY, _Real, 1}, {h, _Real,
> 0},
>      {nn, _Integer, 0}, {ord, _Integer, 0}},
> First[Inverse[Sum[Outer[Times, Table[If[Positive[q], (XX[[i]] - xj)^q,
> 1], {q, 0, ord}],
> Table[If[Positive[q], (XX[[i]] - xj)^q, 1.], {q, 0,
> ord}]*E^(-0.5*((XX[[i]] - xj)/h)^2)], {i, nn}]] .
> Sum[(Table[If[Positive[q], (XX[[i]] - xj)^q, 1.], {q, 0, ord}]*YY[[i]])*
> E^(-0.5*((XX[[i]] - xj)/h)^2), {i, nn}]]];
> *)
> 
> (*
> \!\(tt = MemoryInUse[];
>   ListPlot[Table[{\((i + 1)\)\^2, \(Timing[
>               nn = \((i + 1)\)\^2; \[Epsilon] = Table[Random[]*3, {i,
> nn}];
>               testX = Table[i* .3 - Random[]*2, {i, nn}];
>               testY = Table[Sin[i/3] - 2, {i, nn}] + \[Epsilon];
>               Map[w[#, testX, testY,  .1 + Random[], nn, 0] &,
>                 testX];]\)[\([1]\)]/Second}, {i, 15}], PlotJoined ->
> True,
>     PlotLabel -> "\<Calculation Times as a function of n\>"];
>   MemoryInUse[] - tt\)
> *)
> 
> I have followed Ted Ersek's tips and tricks
> (http://www.verbeia.com/mathematica/tips/tip_index.html) about Compile,
> and have tried changing all variable names (works sometimes), removing
> any hidden spaces, restructuring the formulas, changing all 0's to 0. 's
> and all 1's to 1. 's, etcetera etcetera, but I still can't comprehend
> what the problem might be.  Doing "w[[-2]]" shows a list of op-code
> numbers, and one function name, Inverse[#1]&, so it seems to me that
> there are no problems with the use of Compile here. Would anyone have
> any thoughts???
> 
> Regards,
> 
> Bernard Gress
> burnthebiscuit at netscape.net


  • Prev by Date: Re: 2 gifs side by side -- with hyperlinks
  • Next by Date: Re: executing a notebook from the command line
  • Previous by thread: Arbitrary Crash with Compile
  • Next by thread: Re: Arbitrary Crash with Compile