diff options
author | Karl Berry <karl@freefriends.org> | 2009-07-08 01:04:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-07-08 01:04:31 +0000 |
commit | 17ee31b51081b8281b652fa06b997918003f7772 (patch) | |
tree | c5c1420540fe9a31454c1450ec5d96c096f91a9b /Master/texmf | |
parent | bf914f81a2ff8552e1438251f4b6b56f9acf0b90 (diff) |
asymptote 1.80
git-svn-id: svn://tug.org/texlive/trunk@14179 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-x | Master/texmf/asymptote/GUI/xasyVersion.py | 2 | ||||
-rw-r--r-- | Master/texmf/asymptote/animation.asy | 31 | ||||
-rw-r--r-- | Master/texmf/asymptote/lmfit.asy | 89 | ||||
-rw-r--r-- | Master/texmf/asymptote/version.asy | 2 | ||||
-rw-r--r-- | Master/texmf/doc/info/asy-faq.info | 2 | ||||
-rw-r--r-- | Master/texmf/doc/man/man1/asy.1 | 19 |
6 files changed, 105 insertions, 40 deletions
diff --git a/Master/texmf/asymptote/GUI/xasyVersion.py b/Master/texmf/asymptote/GUI/xasyVersion.py index 36de0c7c4c2..bbaa05404dc 100755 --- a/Master/texmf/asymptote/GUI/xasyVersion.py +++ b/Master/texmf/asymptote/GUI/xasyVersion.py @@ -1,2 +1,2 @@ #!/usr/bin/env python -xasyVersion = "1.79" +xasyVersion = "1.80" diff --git a/Master/texmf/asymptote/animation.asy b/Master/texmf/asymptote/animation.asy index 2b7519c700a..6fcd2ad70e2 100644 --- a/Master/texmf/asymptote/animation.asy +++ b/Master/texmf/asymptote/animation.asy @@ -38,8 +38,8 @@ struct animation { this.global=global; } - string basename(string prefix=prefix) { - return "_"+stripextension(prefix); + string basename(string prefix=stripextension(prefix)) { + return "_"+prefix; } string name(string prefix, int index) { @@ -47,7 +47,7 @@ struct animation { } private string nextname() { - string name=name(prefix,index); + string name=basename(name(prefix,index)); ++index; return name; } @@ -61,8 +61,9 @@ struct animation { void add(picture pic=currentpicture, fit fit=NoBox) { if(global) { + ++index; pictures.push(pic.copy()); - } else this.shipout(nextname(),fit(prefix,pic)); + } else this.shipout(fit(prefix,pic)); } void purge(bool keep=settings.keep) { @@ -89,6 +90,7 @@ struct animation { void export(string prefix=prefix, fit fit=NoBox, bool multipage=false, bool view=false) { if(pictures.length == 0) return; + if(!global) multipage=false; rescale(pictures); frame multi; bool inlinetex=settings.inlinetex; @@ -119,6 +121,7 @@ struct animation { string load(int frames, real delay=animationdelay, string options="", bool multipage=false) { + if(!global) multipage=false; string s="\animategraphics["+options+"]{"+format("%.18f",1000/delay,"C")+ "}{"+basename(); if(!multipage) s += "+"; @@ -129,13 +132,13 @@ struct animation { string pdf(fit fit=NoBox, real delay=animationdelay, string options="", bool keep=settings.keep, bool multipage=true) { if(settings.inlinetex) multipage=true; + if(!global) multipage=false; if(settings.tex != "pdflatex") abort("inline pdf animations require -tex pdflatex"); if(settings.outformat != "") settings.outformat="pdf"; string filename=basename(); string pdfname=filename+".pdf"; - bool single=global && multipage; if(global) export(filename,fit,multipage=multipage); @@ -147,28 +150,28 @@ struct animation { void exitfunction() { if(currentexitfunction != null) currentexitfunction(); this.purge(); - if(single) + if(multipage) delete(pdfname); } atexit(exitfunction); } - if(!single) + if(!multipage) delete(pdfname); - return load(pictures.length,delay,options,multipage); + return load(index,delay,options,multipage); } int movie(fit fit=NoBox, int loops=0, real delay=animationdelay, string format=settings.outformat == "" ? "gif" : settings.outformat, string options="", bool keep=settings.keep) { - if(global && format == "pdf") { - export(fit,multipage=true,view=true); - return 0; - } - - if(global) + if(global) { + if(format == "pdf") { + export(fit,multipage=true,view=true); + return 0; + } export(fit); + } return merge(loops,delay,format,options,keep); } } diff --git a/Master/texmf/asymptote/lmfit.asy b/Master/texmf/asymptote/lmfit.asy index d0367547b74..72745625824 100644 --- a/Master/texmf/asymptote/lmfit.asy +++ b/Master/texmf/asymptote/lmfit.asy @@ -23,6 +23,18 @@ */ /* + Fitting $n$ data points $(x_1, y_1 \pm \Delta y_1), \dots, (x_n, y_n \pm \Delta y_n)$ + to a function $f$ that depends on $m$ parameters $a_1, \dots, a_m$ means minimizing + the least-squares sum + % + \begin{equation*} + \sum_{i = 1}^n \left( \frac{y_i - f(a_1, \dots, a_m; x_i)}{\Delta y_i} \right)^2 + \end{equation*} + % + with respect to the parameters $a_1, \dots, a_m$. +*/ + +/* This module provides an implementation of the Levenberg--Marquardt (LM) algorithm, converted from the C lmfit routine by Joachim Wuttke (see http://www.messen-und-deuten.de/lmfit/). @@ -747,16 +759,20 @@ void lm_minimize(int m_dat, int n_par, real[] par, lm_evaluate_ftype evaluate, l // convenience functions; wrappers of lm_minimize -struct FitControl { - real squareSumTolerance; - real approximationTolerance; - real desiredOrthogonality; - real epsilon; - real stepBound; - int maxIterations; - bool verbose; - void operator init(real squareSumTolerance, real approximationTolerance, real desiredOrthogonality, real epsilon, real stepBound, int maxIterations, bool verbose) { +/* + The structure FitControl specifies various control parameters. +*/ +struct FitControl { + real squareSumTolerance; // relative error desired in the sum of squares + real approximationTolerance; // relative error between last two approximations + real desiredOrthogonality; // orthogonality desired between the residue vector and its derivatives + real epsilon; // step used to calculate the jacobian + real stepBound; // initial bound to steps in the outer loop + int maxIterations; // maximum number of iterations + bool verbose; // whether to print detailed information about every iteration, or nothing + + void operator init(real squareSumTolerance=LM_USERTOL, real approximationTolerance=LM_USERTOL, real desiredOrthogonality=LM_USERTOL, real epsilon=LM_USERTOL, real stepBound=100, int maxIterations=100, bool verbose=false) { this.squareSumTolerance = squareSumTolerance; this.approximationTolerance = approximationTolerance; this.desiredOrthogonality = desiredOrthogonality; @@ -779,30 +795,44 @@ struct FitControl { } }; +FitControl operator init() { + return FitControl(); +} + FitControl defaultControl; -defaultControl.squareSumTolerance = LM_USERTOL; -defaultControl.approximationTolerance = LM_USERTOL; -defaultControl.desiredOrthogonality = LM_USERTOL; -defaultControl.epsilon = LM_USERTOL; -defaultControl.stepBound = 100; -defaultControl.maxIterations = 100; -defaultControl.verbose = false; +/* + Upon returning, this structure provides information about the fit. +*/ struct FitResult { - restricted real norm; - restricted int iterations; - restricted int status; + real norm; // norm of the residue vector + int iterations; // actual number of iterations + int status; // status of minimization - void operator init(real norm, int status, int iterations) { + void operator init(real norm, int iterations, int status) { this.norm = norm; - this.status = status; this.iterations = iterations; + this.status = status; } }; -// Fits data points (xdata, ydata ± errors) to the given function using the given parameters. +/* + Fits data points to a function that depends on some parameters. + + Parameters: + - xdata: Array of x values. + - ydata: Array of y values. + - errors: Array of experimental errors; each element must be strictly positive + - function: Fit function. + - parameters: Parameter array. Before calling fit(), this must contain the initial guesses for the parameters. + Upon return, it will contain the solution parameters. + - control: object of type FitControl that controls various aspects of the fitting procedure. + + Returns: + An object of type FitResult that conveys information about the fitting process. +*/ FitResult fit(real[] xdata, real[] ydata, real[] errors, real function(real[], real), real[] parameters, FitControl control=defaultControl) { int m_dat = min(xdata.length, ydata.length); int n_par = parameters.length; @@ -831,7 +861,20 @@ FitResult fit(real[] xdata, real[] ydata, real[] errors, real function(real[], r } -// Fits data points (xdata, ydata) to the given function using the given parameters. +/* + Fits data points to a function that depends on some parameters. + + Parameters: + - xdata: Array of x values. + - ydata: Array of y values. + - function: Fit function. + - parameters: Parameter array. Before calling fit(), this must contain the initial guesses for the parameters. + Upon return, it will contain the solution parameters. + - control: object of type FitControl that controls various aspects of the fitting procedure. + + Returns: + An object of type FitResult that conveys information about the fitting process. +*/ FitResult fit(real[] xdata, real[] ydata, real function(real[], real), real[] parameters, FitControl control=defaultControl) { return fit(xdata, ydata, array(min(xdata.length, ydata.length), 1.0), function, parameters, control); } diff --git a/Master/texmf/asymptote/version.asy b/Master/texmf/asymptote/version.asy index ab6167a50a5..f071711bae7 100644 --- a/Master/texmf/asymptote/version.asy +++ b/Master/texmf/asymptote/version.asy @@ -1 +1 @@ -string VERSION="1.79"; +string VERSION="1.80"; diff --git a/Master/texmf/doc/info/asy-faq.info b/Master/texmf/doc/info/asy-faq.info index 4112c7fc9c3..079d2754bc9 100644 --- a/Master/texmf/doc/info/asy-faq.info +++ b/Master/texmf/doc/info/asy-faq.info @@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir) ASYMPTOTE FREQUENTLY ASKED QUESTIONS - 02 Jul 2009 + 06 Jul 2009 This is the list of Frequently Asked Questions about Asymptote (asy). diff --git a/Master/texmf/doc/man/man1/asy.1 b/Master/texmf/doc/man/man1/asy.1 index 3ec3130e9aa..e47d5714dc9 100644 --- a/Master/texmf/doc/man/man1/asy.1 +++ b/Master/texmf/doc/man/man1/asy.1 @@ -39,6 +39,7 @@ Center, Bottom, Top, or Zero page alignment [C]. .TP .B \-antialias n Antialiasing width for rasterized output [2]. +-arcballradius pixels Arcball radius [750] .TP .B \-auto3D Automatically activate 3D scene [true]. @@ -79,6 +80,9 @@ Enable debugging messages [false]. .B \-divisor n Garbage collect using purge(divisor=n) [2]. .TP +.B \-doubleclick ms +Emulated double-click timeout [200]. +.TP .B \-embed Embed rendered preview image [true]. .TP @@ -187,6 +191,9 @@ Suppress welcome message [false]. .B \-render n Render 3D graphics using n pixels per bp (-1=auto) [-1]. .TP +.B \-resizestep step +Resize step [1.2]. +.TP .B \-rgb Convert cmyk colors to rgb [false]. .TP @@ -196,6 +203,9 @@ Disable system call [true]. .B \-scroll n Scroll standard output n lines at a time [0]. .TP +.B \-spinstep deg/sec +Spin speed [60]. +.TP .B \-tabcompletion Interactive prompt auto-completion [true]. .TP @@ -235,11 +245,20 @@ Show version; command-line only. .B \-wait Wait for child processes to finish before exiting [false]. .TP +.B \-warn string +Enable warning; command-line only. +.TP .B \-where Show where listed variables are declared [false]. .TP .B \-xformat format GUI deconstruction format [png]. +.TP +.B \-zoomfactor factor +Zoom step factor [1.05]. +.TP +.B \-zoomstep step +Mouse motion zoom step [0.1]. .SH SEE ALSO Asymptote is documented fully in the asymptote Info page. |