MathGroup Archive 2008

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

Search the Archive

A Mathematica implementation of SolvOpt

I recently uploaded a Mathematica implementation of SolvOpt
(an implementation of Shor's r algorithm for the minimization of
nonlinear, possibly non-smooth objective functions) to
The main package is SolvOpt.m, with shorTest.m and the notebook
SolvOptTest.nb being for demonstration purposes.
The original (Fortran, C, and other) implementations and documentation
are available at

As this is my 1st mathematica package (I've only ever used notebooks
interactively before) I'd
appreciate any suggestions or constructive criticism, especially with
regard to efficiency and style.

For example I'd like a more efficient and elegant way to express
   deltax[[j]] = If[  g0[[j]] >= 0.0, h1*ddx, -h1*ddx]
, {j,n}

which in Fortran 95 can be written very clearly as

Where(g0 >= 0.0)
    g0 = h1*ddx
    g0 = -h1*ddx
End Where

where g0 can be any array of up to 7 dimensions, & any number of array
can appear in each section (not just the one shown here), moreover the
'Where' can itself
be nested inside another where etc.. For now a construct which works
for the 1D list above
and avoids the do loop would be fine, though if there is a general
method for masked array assignments in Mathematica I love to hear
about it.



  • Prev by Date: Re: Re: Question on the Limiting Value of Ratios of Consecuative Primes...
  • Next by Date: Manipulate Hints, Tips, Tricks
  • Previous by thread: ListDensityPlot / CountryData: Small glitch in the 6.0.2 documentation
  • Next by thread: Re: A Mathematica implementation of SolvOpt