diff options
63 files changed, 2695 insertions, 1606 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README index 1f9e9fb5353..70414c3b236 100644 --- a/Build/source/utils/README +++ b/Build/source/utils/README @@ -1,11 +1,10 @@ $Id$ -Copyright 2005, 2006, 2007, 2008, 2009 TeX Users Group. -You may freely use, modify and/or distribute this file. +Public domain. Originally written 2005 by Karl Berry. Extra utilities we (optionally) compile for TeX Live. See comments in ../texk/README. -asymptote 1.93 - checked 20apr10 +asymptote 1.94 - checked 9may10 update to TL from CTAN, to include prebuilt doc. see http://tug.org/texlive/build.html#asymptote and tlpkg/bin/tl-update-asy @@ -23,10 +22,10 @@ psutils p17 - checked 25nov06 (Fabrice made small modifications for Windows, it seems) http://www.ctan.org/support/psutils/ -t1utils 1.34 - checked 2mar08 +t1utils 1.34 - checked 2mar08 (needs 1.35) http://www.lcdf.org/type/ -tpic2pdftex +tpic2pdftex 1.97 - checked 9may10 http://www.ctan.org/graphics/tpic2pdftex vlna 1.2 - checked 26jun08 diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog index 2591c21da06..8fc2ecbac2c 100644 --- a/Build/source/utils/asymptote/ChangeLog +++ b/Build/source/utils/asymptote/ChangeLog @@ -1,4 +1,250 @@ ------------------------------------------------------------------------ +r4903 | jcbowman | 2010-05-04 14:47:23 -0600 (Tue, 04 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/settings.cc + +Predefine a default docdir for MSWindows. + +------------------------------------------------------------------------ +r4902 | jcbowman | 2010-05-04 12:54:30 -0600 (Tue, 04 May 2010) | 1 line +Changed paths: + M /trunk/asymptote/patches/cygwin_xdr.patch + +Update CYGWIN xdr patch. +------------------------------------------------------------------------ +r4901 | jcbowman | 2010-05-04 11:18:57 -0600 (Tue, 04 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/filesurface.asy + +Document fit3() and remove restriction on projection.center. + +------------------------------------------------------------------------ +r4900 | jcbowman | 2010-05-04 01:33:17 -0600 (Tue, 04 May 2010) | 1 line +Changed paths: + M /trunk/asymptote/util.h + +Add missing CYGWIN declarations. +------------------------------------------------------------------------ +r4899 | jcbowman | 2010-05-03 22:52:36 -0600 (Mon, 03 May 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/plain_paths.asy + M /trunk/asymptote/doc/asymptote.texi + +Document pair dir(path, path). +------------------------------------------------------------------------ +r4898 | jcbowman | 2010-05-03 22:43:55 -0600 (Mon, 03 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/math.asy + M /trunk/asymptote/doc/asymptote.texi + +Update documentation of math module. + +------------------------------------------------------------------------ +r4897 | jcbowman | 2010-05-03 22:08:46 -0600 (Mon, 03 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/slide.asy + +Use outprefix(). + +------------------------------------------------------------------------ +r4896 | jcbowman | 2010-05-03 21:40:17 -0600 (Mon, 03 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/arrayop.h + M /trunk/asymptote/builtin.cc + +Implement matrix negation for arithmetic types. + +------------------------------------------------------------------------ +r4895 | jcbowman | 2010-05-03 14:45:00 -0600 (Mon, 03 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/base/math.asy + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/runarray.in + M /trunk/asymptote/runpath3d.in + M /trunk/asymptote/runpicture.in + M /trunk/asymptote/runtimebase.in + +Move pair[][] operator * (pair[][] a, pair[][] b) to C++. + +------------------------------------------------------------------------ +r4894 | jcbowman | 2010-05-03 01:56:45 -0600 (Mon, 03 May 2010) | 6 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/README + M /trunk/asymptote/doc/FAQ/Makefile + M /trunk/asymptote/doc/Makefile.in + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/doc/png/Makefile.in + M /trunk/asymptote/examples/slidedemo.asy + +Add make cleaner target that runs make clean in the doc directory and make +distclean everywhere else. + +Change make clean in doc directory so that it no longer removes asymptote.pdf +and CAD.pdf. + +------------------------------------------------------------------------ +r4893 | jcbowman | 2010-05-03 01:52:36 -0600 (Mon, 03 May 2010) | 3 lines +Changed paths: + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/three.asy + +Add picture.fit3(projection P=currentprojection) and +add(picture dest=currentpicture, frame src, triple position) routines. + +------------------------------------------------------------------------ +r4892 | jcbowman | 2010-05-02 23:05:10 -0600 (Sun, 02 May 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/plain.asy + +Avoid redundant mismatched version warnings. +------------------------------------------------------------------------ +r4891 | jcbowman | 2010-05-02 22:52:40 -0600 (Sun, 02 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/flatguide.cc + +Fix guide bug intoduced in r3817. + +------------------------------------------------------------------------ +r4890 | jcbowman | 2010-05-02 17:22:14 -0600 (Sun, 02 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/runmath.in + +Use a larger table for generating random numbers. + +------------------------------------------------------------------------ +r4889 | jcbowman | 2010-05-02 01:03:23 -0600 (Sun, 02 May 2010) | 1 line +Changed paths: + M /trunk/asymptote/fftw++.h + +Use accurate roots of unity in FFT shift. +------------------------------------------------------------------------ +r4888 | jcbowman | 2010-05-01 10:14:10 -0600 (Sat, 01 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Fix fftNormalize. + +------------------------------------------------------------------------ +r4887 | jcbowman | 2010-05-01 08:21:08 -0600 (Sat, 01 May 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Update documentation of addViews. + +------------------------------------------------------------------------ +r4886 | jcbowman | 2010-04-29 02:30:10 -0600 (Thu, 29 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/fftw++.h + +Improve fftw interface. +------------------------------------------------------------------------ +r4885 | jcbowman | 2010-04-27 22:19:50 -0600 (Tue, 27 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/contour.asy + +Make local variables private. + +------------------------------------------------------------------------ +r4884 | jcbowman | 2010-04-26 11:31:24 -0600 (Mon, 26 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_paths.asy + M /trunk/asymptote/examples/orthocenter.asy + +Make pair dir(path,path) return a unit vector. + +------------------------------------------------------------------------ +r4883 | jcbowman | 2010-04-26 11:28:15 -0600 (Mon, 26 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/runpair.in + +Fix return type of dot(pair,pair). + +------------------------------------------------------------------------ +r4882 | jcbowman | 2010-04-25 22:05:00 -0600 (Sun, 25 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/fftw++.h + M /trunk/asymptote/pair.h + M /trunk/asymptote/runarray.in + M /trunk/asymptote/runpair.in + M /trunk/asymptote/triple.h + +Implement pair dot(pair[] a, pair[] b). + +------------------------------------------------------------------------ +r4881 | jcbowman | 2010-04-20 10:02:39 -0600 (Tue, 20 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/settings.cc + +Work around MSWindows registry problems. +------------------------------------------------------------------------ +r4880 | jcbowman | 2010-04-20 09:21:34 -0600 (Tue, 20 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/settings.cc + +Work around empty docdir. +------------------------------------------------------------------------ +r4879 | jcbowman | 2010-04-18 10:21:14 -0600 (Sun, 18 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Move shift variable to Execute. + +------------------------------------------------------------------------ +r4878 | jcbowman | 2010-04-18 08:43:11 -0600 (Sun, 18 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_arrows.asy + +Fix SimpleHead. + +------------------------------------------------------------------------ +r4877 | jcbowman | 2010-04-17 23:20:54 -0600 (Sat, 17 Apr 2010) | 5 lines +Changed paths: + M /trunk/asymptote/arrayop.h + M /trunk/asymptote/base/math.asy + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/castop.h + +Move basic matrix operators from math.asy to C++ code and implement int +and pair versions. + +Add vector and matrix conjugate operations. + +------------------------------------------------------------------------ +r4876 | jcbowman | 2010-04-17 17:39:05 -0600 (Sat, 17 Apr 2010) | 5 lines +Changed paths: + M /trunk/asymptote/arrayop.h + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/castop.h + M /trunk/asymptote/runarray.in + +Add casts from int[][] to real[][], int[][] to pair[][], and real[][] to +pair[][]. + +Implement int[][] diagonal(int[]) and pair[][] diagonal(pair[]). + +------------------------------------------------------------------------ +r4875 | jcbowman | 2010-04-17 16:37:44 -0600 (Sat, 17 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_filldraw.asy + M /trunk/asymptote/doc/asymptote.texi + +Implement a RadialShadeDraw filltype. + +------------------------------------------------------------------------ +r4874 | jcbowman | 2010-04-17 09:33:56 -0600 (Sat, 17 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.94svn. +------------------------------------------------------------------------ r4873 | jcbowman | 2010-04-16 20:13:15 -0600 (Fri, 16 Apr 2010) | 8 lines Changed paths: M /trunk/asymptote/base/plain_picture.asy diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in index bf93e2a9e5b..5da2b48b6d3 100644 --- a/Build/source/utils/asymptote/Makefile.in +++ b/Build/source/utils/asymptote/Makefile.in @@ -108,10 +108,10 @@ $(GCLIB): $(GC).tar.gz tar -xf $(GC).tar rm -f $(GC).tar if test "$(GC)" = "gc6.8"; then \ - cd $(GC)/include; patch < ../../patches/gc6.8_AIX.patch; \ + cd $(GC)/include && patch < ../../patches/gc6.8_AIX.patch; \ fi if test "$(GC)" = "gc-7.0"; then \ - cd $(GC)/include/private; patch < ../../../patches/gc-7.0nomem.patch;\ + cd $(GC)/include/private && patch < ../../../patches/gc-7.0nomem.patch;\ fi cd $(GC); \ ./configure $(GCOPTIONS); \ @@ -120,16 +120,16 @@ $(GCLIB): $(GC).tar.gz $(GCPPLIB): $(GCLIB) dvi: asy - cd doc; $(MAKE) dvi + cd doc && $(MAKE) dvi html: asy - cd doc; $(MAKE) doc + cd doc && $(MAKE) doc man: asy - cd doc; $(MAKE) man + cd doc && $(MAKE) man faq: asy - cd doc; $(MAKE) faq + cd doc && $(MAKE) faq $(RUNTIME_FILES:=.cc): %.cc: runtime.pl runtimebase.in %.in ./runtime.pl $(@:.cc=) @@ -183,36 +183,36 @@ install-asy: asy -${INSTALL} -p -m 644 $(addprefix doc/,$(CONTEXTFILES)) $(contextdir) install-html: html - cd doc; $(MAKE) install-all + cd doc && $(MAKE) install-all install-man: man - cd doc; $(MAKE) install + cd doc && $(MAKE) install install-prebuilt: install-asy - cd doc; $(MAKE) install-prebuilt + cd doc && $(MAKE) install-prebuilt uninstall: uninstall-all uninstall-all: uninstall-man uninstall-asy uninstall-asy: - -cd $(animationsdir); rm -f *.asy *.tex + -cd $(animationsdir) && rm -f *.asy *.tex -rmdir $(animationsdir) - -cd $(exampledir); rm -f $(EXEXTRA) $(DOCEXTRA) + -cd $(exampledir) && rm -f $(EXEXTRA) $(DOCEXTRA) -rmdir $(exampledir) -rmdir $(docdir) - -cd $(GUIdir); rm -f *.py + -cd $(GUIdir) && rm -f *.py -rmdir $(GUIdir) - -cd $(asydir); rm -f asy-keywords.el *.asy $(EXTRA) + -cd $(asydir) && rm -f asy-keywords.el *.asy $(EXTRA) -rmdir $(asydir) - -cd $(latexdir); rm -f $(LATEXFILES) + -cd $(latexdir) && rm -f $(LATEXFILES) -rmdir $(latexdir) - -cd $(contextdir); rm -f $(CONTEXTFILES) + -cd $(contextdir) && rm -f $(CONTEXTFILES) -rmdir $(contextdir) - -cd $(bindir); rm -f $(NAME) $(XNAME) + -cd $(bindir) && rm -f $(NAME) $(XNAME) uninstall-man: - cd doc; $(MAKE) uninstall + cd doc && $(MAKE) uninstall prc-clean: FORCE -rm -f prc/*.o prc/*.d @@ -225,14 +225,16 @@ gc-clean: FORCE clean $(MAKE) -C $(GC) clean; \ fi -cleaner: FORCE distclean -distclean: FORCE clean +cleaner: FORCE clean -if test -d $(GC); then \ rm -rf $(GC); \ fi -rm -f Makefile config.h config.log config.status errors.temp - cd doc; $(MAKE) distclean - cd tests; $(MAKE) distclean + cd doc && $(MAKE) clean + cd tests && $(MAKE) distclean + +distclean: FORCE cleaner + cd doc && $(MAKE) distclean cleanest: FORCE maintainer-clean maintainer-clean: FORCE distclean diff --git a/Build/source/utils/asymptote/README b/Build/source/utils/asymptote/README index 1dd3e3e3785..7f26d0f69d3 100644 --- a/Build/source/utils/asymptote/README +++ b/Build/source/utils/asymptote/README @@ -1,5 +1,5 @@ ASYMPTOTE - Copyright 2004-9 Andy Hammerlindl, John Bowman, and Tom Prince + Copyright 2004-10 Andy Hammerlindl, John Bowman, and Tom Prince Asymptote is a powerful descriptive vector graphics language for technical drawings, inspired by MetaPost but with an improved C++-like @@ -19,11 +19,13 @@ Questions and comments should be sent to the Asymptote Forum: http://sourceforge.net/forum/forum.php?forum_id=409349 -All files in the Asymptote project, unless explicitly noted otherwise, +All source files in the Asymptote project, unless explicitly noted otherwise, are released under version 3 (or later) of the GNU Lesser General Public License (see the files LICENSE.LESSER and LICENSE in the top-level source directory). +======================================================================== + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or @@ -38,4 +40,21 @@ You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +======================================================================== + +Note that the MSWindows executable version of Asymptote can only be +released under the GNU General Public License (GPL) as it is linked against +the GNU Scientific Library, GNU Readline library, and other GPL +libraries. This version of Asymptote also ships with the dll libraries +noted below. + +The source code for cygwin1.dll is available under the GPL license: +http://cygwin.com/snapshots/cygwin-src-20100413.tar.bz2 + +The source code for freeglut.dll is available under the X-Consortium license: +http://prdownloads.sourceforge.net/freeglut/freeglut-2.6.0.tar.gz +The source code for glu32.dll is available from +ftp://ftp.freedesktop.org/pub/mesa/7.6/MesaLib-7.6.tar.bz2 +and patched as detailed here: +http://old.nabble.com/Error-building-MesaLib-7.6-onto-Win32-with-Microsoft-Visual-Studio-2005-and-2008-td25990977.html diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes index 59d6eb02f87..0ba45e48a1c 100644 --- a/Build/source/utils/asymptote/ReleaseNotes +++ b/Build/source/utils/asymptote/ReleaseNotes @@ -1,3 +1,13 @@ +Release Notes for Version 1.94 + +Work arounds for MSWindows registry problems and obsolete runtime libraries +were implemented. The SimpleHead arrowhead was fixed. Additional matrix +routines and casts were implemented. The pair dir(path, path) routine now +returns a unit vector. Variable conflicts coming from the contour module +were addressed. A RadialShadeDraw filltype was implemented. A guide bug was +fixed. Redundant mismatched version warnings are avoided. Support for +fitting one 3D picture within another was added. The documentation was updated. + Release Notes for Version 1.93 Portability issues were addressed. Latticeshading bounds and behaviour @@ -17,7 +27,7 @@ alignment and pt scalings were fixed. Latticeshading is now properly clipped. The normal and true Circle calculations were fixed. The interface to the simpson integrator and an array index in contour.asy were fixed. In the flowchart module, the implicit cast from a pair to a virtual node was -removed in favour of a block constructor. The ode integrationg routines now +removed in favour of a block constructor. The ode integration routines now return a structure that includes the sampled time values; dynamic timestepping was implemented for solveBVP. New predefined tick modifiers were added. The CLZ and CTZ bit functions were implemented. PRC part names @@ -1605,3 +1615,5 @@ the frame for filling with a background color; they also return the boundary as a guide. A workaround was added for a bug in gcc version 3.3 to facilitate compilation under Darwin (MacOS). Many internal coding improvements were made. + + LocalWords: arounds diff --git a/Build/source/utils/asymptote/arrayop.h b/Build/source/utils/asymptote/arrayop.h index 435c00926c0..7832c1f64dc 100644 --- a/Build/source/utils/asymptote/arrayop.h +++ b/Build/source/utils/asymptote/arrayop.h @@ -64,28 +64,6 @@ void arrayArrayOp(vm::stack *s) } template<class T> -inline void arrayNegate(vm::stack *s) -{ - array *a=pop<array*>(s); - size_t size=checkArray(a); - array *c=new array(size); - for(size_t i=0; i < size; i++) - (*c)[i]=-read<T>(a,i); - s->push(c); -} - -template<> -inline void arrayNegate<Int>(vm::stack *s) -{ - array *a=pop<array*>(s); - size_t size=checkArray(a); - array *c=new array(size); - for(size_t i=0; i < size; i++) - (*c)[i]=Negate(read<Int>(a,i),i); - s->push(c); -} - -template<class T> void sumArray(vm::stack *s) { array *a=pop<array*>(s); @@ -161,6 +139,61 @@ void binopArray3(vm::stack *s) s->push(m); } +template<class T, class U, template <class S> class op> +void array2Op(vm::stack *s) +{ + U b=pop<U>(s); + array *a=pop<array*>(s); + size_t size=checkArray(a); + array *c=new array(size); + for(size_t i=0; i < size; ++i) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + array *ci=new array(aisize); + (*c)[i]=ci; + for(size_t j=0; j < aisize; j++) + (*ci)[j]=op<T>()(read<T>(ai,j),b,0); + } + s->push(c); +} + +template<class T, class U, template <class S> class op> +void opArray2(vm::stack *s) +{ + array *a=pop<array*>(s); + T b=pop<T>(s); + size_t size=checkArray(a); + array *c=new array(size); + for(size_t i=0; i < size; ++i) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + array *ci=new array(aisize); + (*c)[i]=ci; + for(size_t j=0; j < aisize; j++) + (*ci)[j]=op<U>()(read<U>(ai,j),b,0); + } + s->push(c); +} + +template<class T, template <class S> class op> +void array2Array2Op(vm::stack *s) +{ + array *b=pop<array*>(s); + array *a=pop<array*>(s); + size_t size=checkArrays(a,b); + array *c=new array(size); + for(size_t i=0; i < size; ++i) { + array *ai=read<array*>(a,i); + array *bi=read<array*>(b,i); + size_t aisize=checkArrays(ai,bi); + array *ci=new array(aisize); + (*c)[i]=ci; + for(size_t j=0; j < aisize; j++) + (*ci)[j]=op<T>()(read<T>(ai,j),read<T>(bi,j),0); + } + s->push(c); +} + template<class T> bool Array2Equals(vm::stack *s) { @@ -196,6 +229,24 @@ void array2NotEquals(vm::stack *s) } template<class T> +void diagonal(vm::stack *s) +{ + array *a=pop<array*>(s); + size_t n=checkArray(a); + array *c=new array(n); + for(size_t i=0; i < n; ++i) { + array *ci=new array(n); + (*c)[i]=ci; + for(size_t j=0; j < i; ++j) + (*ci)[j]=T(); + (*ci)[i]=read<T>(a,i); + for(size_t j=i+1; j < n; ++j) + (*ci)[j]=T(); + } + s->push(c); +} + +template<class T> struct compare { bool operator() (const vm::item& a, const vm::item& b) { @@ -435,6 +486,23 @@ void arrayFunc(vm::stack *s) s->push(c); } +template <class T, class S, T (*func)(S)> +void arrayFunc2(vm::stack *s) +{ + array *a=pop<array*>(s); + size_t size=checkArray(a); + array *c=new array(size); + for(size_t i=0; i < size; ++i) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + array *ci=new array(aisize); + (*c)[i]=ci; + for(size_t j=0; j < aisize; j++) + (*ci)[j]=func(read<S>(ai,j)); + } + s->push(c); +} + vm::array *Identity(Int n); camp::triple operator *(const vm::array& a, const camp::triple& v); camp::triple multshiftless(const vm::array& t, const camp::triple& v); diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el index 56ef7697d2a..d0e2246eaad 100644 --- a/Build/source/utils/asymptote/asy-keywords.el +++ b/Build/source/utils/asymptote/asy-keywords.el @@ -2,7 +2,7 @@ ;; This file is automatically generated by asy-list.pl. ;; Changes will be overwritten. ;; -(defvar asy-keywords-version "1.93") +(defvar asy-keywords-version "1.94") (defvar asy-keyword-name '( and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator )) @@ -11,7 +11,7 @@ and controls tension atleast curl if else while for do return break continue str Braid FitResult Label Legend Segment Solution TreeNode abscissa arc arrowhead binarytree binarytreeNode block bool bool3 bounds bqe circle conic coord coordsys cputime ellipse file filltype frame grid3 guide horner hsv hyperbola indexedTransform int inversion key light line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice solution splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triangle trilinear triple vector vertex void )) (defvar asy-function-name '( -AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addnode addnodes addpenarc addpenline adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit atime attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint blend blockconnector boutput box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 empty enclose end endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW isDuplicate isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup magnetize makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markuniform mass masscenter massformat math max max3 maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbezier minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation orig_circlenodesnumber orig_circlenodesnumber1 orig_draw orig_ellipsenodesnumber orig_ellipsenodesnumber1 orig_hyperbolanodesnumber orig_parabolanodesnumber origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setcontour setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin single sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript startTrembling stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose tremble trembleFuzz tremble_circlenodesnumber tremble_circlenodesnumber1 tremble_draw tremble_ellipsenodesnumber tremble_ellipsenodesnumber1 tremble_hyperbolanodesnumber tremble_marknodes tremble_markuniform tremble_parabolanodesnumber triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim trueMagnetize truepoint tube uncycle unfill uniform unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xinput xlimits xoutput xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) +AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade RadialShadeDraw Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addnode addnodes addpenarc addpenline adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit atime attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint blend blockconnector boutput box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 empty enclose end endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW isDuplicate isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup magnetize makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markuniform mass masscenter massformat math max max3 maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbezier minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation orig_circlenodesnumber orig_circlenodesnumber1 orig_draw orig_ellipsenodesnumber orig_ellipsenodesnumber1 orig_hyperbolanodesnumber orig_parabolanodesnumber origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setcontour setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin single sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript startTrembling stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose tremble trembleFuzz tremble_circlenodesnumber tremble_circlenodesnumber1 tremble_draw tremble_ellipsenodesnumber tremble_ellipsenodesnumber1 tremble_hyperbolanodesnumber tremble_marknodes tremble_markuniform tremble_parabolanodesnumber triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim trueMagnetize truepoint tube uncycle unfill uniform unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xinput xlimits xoutput xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) (defvar asy-variable-name '( -AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coeff Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill Up VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentlight currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz edge ellipsenodesnumberfactor eps epsgeo epsilon evenodd extendcap exterior fermionpen figureborder figuremattpen firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbola hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand incommensurate inf infinity institutionpen intMax intMin interior invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow line linemargin lm_infmsg lm_shortmsg longdashdotted longdashed magenta magneticPoints magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker none nopoint noprimary nullpath nullpen numarray ocgindex oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfactor stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom tremblingMode undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportmargin viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding )) +AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coeff Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill Up VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentlight currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz edge ellipsenodesnumberfactor eps epsgeo epsilon evenodd extendcap exterior fermionpen figureborder figuremattpen firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbola hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand inf infinity institutionpen intMax intMin interior invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow line linemargin lm_infmsg lm_shortmsg longdashdotted longdashed magenta magneticPoints magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray ocgindex oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfactor stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom tremblingMode undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportmargin viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding )) diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec index 0ff8b3918ef..1066415ee0b 100644 --- a/Build/source/utils/asymptote/asymptote.spec +++ b/Build/source/utils/asymptote/asymptote.spec @@ -1,7 +1,7 @@ %{!?_texmf: %define _texmf %(eval "echo `kpsewhich -expand-var '$TEXMFLOCAL'`")} Name: asymptote -Version: 1.93 +Version: 1.94 Release: 1%{?dist} Summary: Descriptive vector graphics language diff --git a/Build/source/utils/asymptote/base/contour.asy b/Build/source/utils/asymptote/base/contour.asy index 3c01640b2cc..27a79439e2d 100644 --- a/Build/source/utils/asymptote/base/contour.asy +++ b/Build/source/utils/asymptote/base/contour.asy @@ -13,7 +13,7 @@ import graph_settings; -real eps=sqrtEpsilon; +private real eps=sqrtEpsilon; /* GRID CONTOURS @@ -53,15 +53,14 @@ real eps=sqrtEpsilon; */ -typedef int boxtype; -boxtype exterior=-1; -boxtype edge = 0; -boxtype interior=+1; +private typedef int boxtype; +private boxtype exterior=-1; +private boxtype edge = 0; +private boxtype interior=+1; -typedef int contourshape; -contourshape none =0; -contourshape line =1; -contourshape hyperbola=2; +private typedef int contourshape; +private contourshape line =1; +private contourshape hyperbola=2; // Describe position by grid square and position in square private struct gridpoint { diff --git a/Build/source/utils/asymptote/base/math.asy b/Build/source/utils/asymptote/base/math.asy index eef703cb7ee..ff267b955d7 100644 --- a/Build/source/utils/asymptote/base/math.asy +++ b/Build/source/utils/asymptote/base/math.asy @@ -89,39 +89,39 @@ triple intersectionpoint(triple n0, triple P0, triple n1, triple P1) } } -// Given a real array A, return its partial sums. -real[] partialsum(real[] A) +// Given a real array a, return its partial sums. +real[] partialsum(real[] a) { - real[] B=new real[A.length]; + real[] b=new real[a.length]; real sum=0; - for(int i=0; i < A.length; ++i) { - sum += A[i]; - B[i]=sum; + for(int i=0; i < a.length; ++i) { + sum += a[i]; + b[i]=sum; } - return B; + return b; } -// Given a real array A, return its partial dx-weighted sums. -real[] partialsum(real[] A, real[] dx) +// Given a real array a, return its partial dx-weighted sums. +real[] partialsum(real[] a, real[] dx) { - real[] B=new real[A.length]; + real[] b=new real[a.length]; real sum=0; - for(int i=0; i < A.length; ++i) { - sum += A[i]*dx[i]; - B[i]=sum; + for(int i=0; i < a.length; ++i) { + sum += a[i]*dx[i]; + b[i]=sum; } - return B; + return b; } -// If strict=false, return whether i > j implies x[i] >= x[j] -// If strict=true, return whether i > j implies x[i] > x[j] -bool increasing(real[] x, bool strict=false) +// If strict=false, return whether i > j implies a[i] >= a[j] +// If strict=true, return whether i > j implies a[i] > a[j] +bool increasing(real[] a, bool strict=false) { - real[] xp=copy(x); - xp.delete(0); - xp.push(0); - bool[] b=strict ? (xp > x) : (xp >= x); - b[x.length-1]=true; + real[] ap=copy(a); + ap.delete(0); + ap.push(0); + bool[] b=strict ? (ap > a) : (ap >= a); + b[a.length-1]=true; return all(b); } @@ -157,67 +157,6 @@ real[][] zero(int n, int m) return M; } -real[][] operator +(real[][] a, real[][] b) -{ - int n=a.length; - real[][] m=new real[n][]; - for(int i=0; i < n; ++i) - m[i]=a[i]+b[i]; - return m; -} - -real[][] operator -(real[][] a, real[][] b) -{ - int n=a.length; - real[][] m=new real[n][]; - for(int i=0; i < n; ++i) - m[i]=a[i]-b[i]; - return m; -} - -real[][] operator *(real[][] a, real b) -{ - int n=a.length; - real[][] m=new real[n][]; - for(int i=0; i < n; ++i) - m[i]=a[i]*b; - return m; -} - -real[][] operator *(real b, real[][] a) -{ - return a*b; -} - -real[][] operator /(real[][] a, real b) -{ - return a*(1/b); -} - -private string incommensurate= - "Multiplication of incommensurate matrices is undefined"; - -pair[][] operator * (pair[][] a, pair[][] b) -{ - int n=a.length; - int nb=b.length; - int nb0=b[0].length; - pair[][] m=new pair[n][nb0]; - for(int i=0; i < n; ++i) { - pair[] ai=a[i]; - pair[] mi=m[i]; - if(ai.length != nb) - abort(incommensurate); - for(int j=0; j < nb0; ++j) { - pair sum; - for(int k=0; k < nb; ++k) - sum += ai[k]*b[k][j]; - mi[j]=sum; - } - } - return m; -} - bool square(real[][] m) { int n=m.length; diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy index cc1a5064038..4d0b4e566fb 100644 --- a/Build/source/utils/asymptote/base/plain.asy +++ b/Build/source/utils/asymptote/base/plain.asy @@ -22,6 +22,7 @@ access version; if(version.VERSION != VERSION) { warning("version","using possibly incompatible version "+ version.VERSION+" of plain.asy"+'\n'); + nowarn("version"); } include plain_strings; diff --git a/Build/source/utils/asymptote/base/plain_arrows.asy b/Build/source/utils/asymptote/base/plain_arrows.asy index 18618c2b5b8..5284ee9650d 100644 --- a/Build/source/utils/asymptote/base/plain_arrows.asy +++ b/Build/source/utils/asymptote/base/plain_arrows.asy @@ -93,7 +93,7 @@ SimpleHead.head=new path(path g, position position=EndPoint, pen p=currentpen, path left=rotate(-angle,x)*r; path right=rotate(angle*factor,x)*r; real[] T=arrowbasepoints(base,left,right); - return subpath(left,T[0],0)--subpath(right,T[1],0); + return subpath(left,T[0],0)--subpath(right,0,T[1]); }; arrowhead HookHead(real dir=arrowdir, real barb=arrowbarb) diff --git a/Build/source/utils/asymptote/base/plain_filldraw.asy b/Build/source/utils/asymptote/base/plain_filldraw.asy index b9cd191e075..a5eea35ef25 100644 --- a/Build/source/utils/asymptote/base/plain_filldraw.asy +++ b/Build/source/utils/asymptote/base/plain_filldraw.asy @@ -186,6 +186,20 @@ filltype RadialShade(pen penc, pen penr) }); } +filltype RadialShadeDraw(real xmargin=0, real ymargin=xmargin, + pen penc, pen penr, pen drawpen=nullpen) +{ + return filltype(new void(frame f, path[] g, pen Drawpen) { + if(drawpen != nullpen) Drawpen=drawpen; + if(Drawpen == nullpen) Drawpen=penc; + pair c=(min(g)+max(g))/2; + if(cyclic(g[0])) + radialshade(f,margin(g,xmargin,ymargin),penc,c,0,penr,c, + abs(max(g)-min(g))/2); + draw(f,margin(g,xmargin,ymargin),Drawpen); + }); +} + // Fill the region in frame dest underneath frame src and return the // boundary of src. path fill(frame dest, frame src, filltype filltype=NoFill, diff --git a/Build/source/utils/asymptote/base/plain_paths.asy b/Build/source/utils/asymptote/base/plain_paths.asy index 3dab68fe32e..b073e8090ec 100644 --- a/Build/source/utils/asymptote/base/plain_paths.asy +++ b/Build/source/utils/asymptote/base/plain_paths.asy @@ -204,9 +204,9 @@ pair dir(path p) return dir(p,length(p)); } -pair dir(path p, path h) +pair dir(path p, path g) { - return 0.5*(dir(p)+dir(h)); + return unit(dir(p)+dir(g)); } // return the point on path p at arclength L diff --git a/Build/source/utils/asymptote/base/plain_picture.asy b/Build/source/utils/asymptote/base/plain_picture.asy index 56ebf9f4bbe..044ba90e7a7 100644 --- a/Build/source/utils/asymptote/base/plain_picture.asy +++ b/Build/source/utils/asymptote/base/plain_picture.asy @@ -1363,6 +1363,18 @@ struct picture { light,P); } + // Fit a 3D picture. + frame fit3(projection P=currentprojection) { + if(settings.render == 0) return fit(P); + if(fixed) return scaled(); + if(empty3()) return newframe; + transform3 t=scaling(xsize3,ysize3,zsize3,keepAspect); + frame f=fit3(t,null,P); + transform3 s=scale3(f,xsize3,ysize3,zsize3,keepAspect); + if(s == identity4) return f; + return fit3(s*t,null,P); + } + // In case only an approximate picture size estimate is available, return the // fitted frame slightly scaled (including labels and true size distances) // so that it precisely meets the given size specification. @@ -1848,14 +1860,14 @@ transform fixedscaling(picture pic=currentpicture, pair min, pair max, pic.keepAspect); } -// Add frame src about position to frame dest with optional grouping. +// Add frame src to frame dest about position with optional grouping. void add(frame dest, frame src, pair position, bool group=false, filltype filltype=NoFill, bool above=true) { add(dest,shift(position)*src,group,filltype,above); } -// Add frame src about position to picture dest with optional grouping. +// Add frame src to picture dest about position with optional grouping. void add(picture dest=currentpicture, frame src, pair position=0, bool group=true, filltype filltype=NoFill, bool above=true) { diff --git a/Build/source/utils/asymptote/base/slide.asy b/Build/source/utils/asymptote/base/slide.asy index dc1608203e1..092c3429145 100644 --- a/Build/source/utils/asymptote/base/slide.asy +++ b/Build/source/utils/asymptote/base/slide.asy @@ -444,7 +444,7 @@ void asyinclude(string s, real xsize=0, real ysize=xsize) picture currentpictureSave=currentpicture; currentpicture=new picture; _eval("include \""+s+"\";",true); - s=stripdirectory(settings.outname+"_"+s); + s=stripdirectory(outprefix()+"_"+s); codefile.push(s); frame f=(xsize > 0 || ysize > 0) ? currentpicture.fit(xsize,ysize) : currentpicture.fit(); @@ -490,7 +490,7 @@ void asyfigure(string s, string options="", string caption="", pair align=S, string asywrite(string s, string preamble="") { static int count=0; - string name=settings.outname+"_slide"+(string) count; + string name=outprefix()+"_slide"+(string) count; ++count; file temp=output(name+".asy"); write(temp,preamble); diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index cc7534f6f79..5b3dd26aba7 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -2610,12 +2610,10 @@ struct scene if(!P.absolute) { this.P=t*P; - if(this.P.center) { - bool recalculate=false; + if(this.P.center && settings.render != 0) { triple target=0.5*(m+M); this.P.target=target; - recalculate=true; - if(recalculate) this.P.calculate(); + this.P.calculate(); } if(this.P.autoadjust || this.P.infinity) adjusted=adjusted | this.P.adjust(m,M); @@ -2754,7 +2752,7 @@ object embed(string label="", string text=label, string prefix=defaultfilename, P=S.T*P; } if(settings.verbose > 0) { - if(P.center || (!P.infinity && P.autoadjust)) + if((P.center && settings.render != 0) || (!P.infinity && P.autoadjust)) write("adjusting target to ",tinv*target); } } @@ -3091,6 +3089,25 @@ fit=new frame[](string prefix="", picture[] pictures, string format="", fit3(prefix,pictures,all,format,view,options,script,P); }; +// Add frame src to picture dest about position. +void add(picture dest=currentpicture, frame src, triple position) +{ + if(is3D(src)) { + dest.add(new void(frame f, transform3 t, picture, projection) { + add(f,shift(t*position)*src); + },true); + } else { + dest.add(new void(frame, transform3 t, picture pic, projection P) { + if(pic != null) { + pic.add(new void(frame f, transform T) { + add(f,T*shift(project(t*position,P))*src); + },true); + } + },true); + } + dest.addBox(position,position,min3(src),max3(src)); +} + exitfcn currentexitfunction=atexit(); void exitfunction() diff --git a/Build/source/utils/asymptote/builtin.cc b/Build/source/utils/asymptote/builtin.cc index 3bca4b4ba06..deb0e223d05 100644 --- a/Build/source/utils/asymptote/builtin.cc +++ b/Build/source/utils/asymptote/builtin.cc @@ -760,6 +760,10 @@ void addCasts(venv &ve) addCast(ve, realArray(), IntArray(), arrayToArray<Int,double>); addCast(ve, pairArray(), IntArray(), arrayToArray<Int,pair>); addCast(ve, pairArray(), realArray(), arrayToArray<double,pair>); + + addCast(ve, realArray2(), IntArray2(), array2ToArray2<Int,double>); + addCast(ve, pairArray2(), IntArray2(), array2ToArray2<Int,pair>); + addCast(ve, pairArray2(), realArray2(), array2ToArray2<double,pair>); } void addGuideOperators(venv &ve) @@ -781,6 +785,24 @@ void addBooleanOperator(venv &ve, bltin f, ty *t, const char *name) } template<class T, template <class S> class op> +void addArray2Array2Op(venv &ve, ty *t3, const char *name) +{ + addFunc(ve,array2Array2Op<T,op>,t3,name,formal(t3,"a"),formal(t3,"b")); +} + +template<class T, template <class S> class op> +void addOpArray2(venv &ve, ty *t1, const char *name, ty *t3) +{ + addFunc(ve,opArray2<T,T,op>,t3,name,formal(t1,"a"),formal(t3,"b")); +} + +template<class T, template <class S> class op> +void addArray2Op(venv &ve, ty *t1, const char *name, ty *t3) +{ + addFunc(ve,array2Op<T,T,op>,t3,name,formal(t3,"a"),formal(t1,"b")); +} + +template<class T, template <class S> class op> void addOps(venv &ve, ty *t1, const char *name, ty *t2) { addSimpleOperator(ve,binaryOp<T,op>,t1,name); @@ -842,6 +864,15 @@ inline double abs(triple v) { return v.length(); } +inline pair conjugate(pair z) { + return conj(z); +} + +template<class T> +inline T negate(T x) { + return -x; +} + template<class T, template <class S> class op> void addBinOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, const char *name) { @@ -877,10 +908,14 @@ void addBasicOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, bool integer=false, addOps<T,plus>(ve,t1,"+",t2); addOps<T,minus>(ve,t1,"-",t2); + addArray2Array2Op<T,plus>(ve,t3,"+"); + addArray2Array2Op<T,minus>(ve,t3,"-"); + addFunc(ve,&id,t1,"+",formal(t1,"a")); addFunc(ve,&id,t2,"+",formal(t2,"a")); addFunc(ve,Negate<T>,t1,"-",formal(t1,"a")); - addFunc(ve,arrayNegate<T>,t2,"-",formal(t2,"a")); + addFunc(ve,arrayFunc<T,T,negate>,t2,"-",formal(t2,"a")); + addFunc(ve,arrayFunc2<T,T,negate>,t3,"-",formal(t3,"a")); if(!integer) addFunc(ve,interp<T>,t1,"interp",formal(t1,"a",false,Explicit), formal(t1,"b",false,Explicit), formal(primReal(),"t")); @@ -894,8 +929,16 @@ void addOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, bool integer=false, bool Explicit=false) { addBasicOps<T>(ve,t1,t2,t3,t4,integer,Explicit); + addOps<T,times>(ve,t1,"*",t2); - if(!integer) addOps<T,run::divide>(ve,t1,"/",t2); + addOpArray2<T,times>(ve,t1,"*",t3); + addArray2Op<T,times>(ve,t1,"*",t3); + + if(!integer) { + addOps<T,run::divide>(ve,t1,"/",t2); + addArray2Op<T,run::divide>(ve,t1,"/",t3); + } + addOps<T,power>(ve,t1,"^",t2); } @@ -975,8 +1018,12 @@ void addOperators(venv &ve) tripleArray3()); addFunc(ve,opArray<double,triple,times>,tripleArray(),"*", formal(primReal(),"a"),formal(tripleArray(),"b")); + addFunc(ve,opArray2<double,triple,timesR>,tripleArray2(),"*", + formal(primReal(),"a"),formal(tripleArray2(),"b")); addFunc(ve,arrayOp<triple,double,timesR>,tripleArray(),"*", formal(tripleArray(),"a"),formal(primReal(),"b")); + addFunc(ve,array2Op<triple,double,timesR>,tripleArray2(),"*", + formal(tripleArray2(),"a"),formal(primReal(),"b")); addFunc(ve,arrayOp<triple,double,divide>,tripleArray(),"/", formal(tripleArray(),"a"),formal(primReal(),"b")); @@ -1001,6 +1048,11 @@ void addOperators(venv &ve) addFunc(ve,arrayFunc<double,triple,abs>,realArray(),"abs", formal(tripleArray(),"a")); + addFunc(ve,arrayFunc<pair,pair,conjugate>,pairArray(),"conj", + formal(pairArray(),"a")); + addFunc(ve,arrayFunc2<pair,pair,conjugate>,pairArray2(),"conj", + formal(pairArray2(),"a")); + addFunc(ve,binaryOp<Int,divide>,primReal(),"/", formal(primInt(),"a"),formal(primInt(),"b")); addFunc(ve,arrayOp<Int,Int,divide>,realArray(),"/", @@ -1018,7 +1070,9 @@ void addOperators(venv &ve) addOps<Int,mod>(ve,primInt(),"%",IntArray()); addOps<double,mod>(ve,primReal(),"%",realArray()); - addRestFunc(ve,run::diagonal,realArray2(),"diagonal",realArray()); + addRestFunc(ve,diagonal<Int>,IntArray2(),"diagonal",IntArray()); + addRestFunc(ve,diagonal<double>,realArray2(),"diagonal",realArray()); + addRestFunc(ve,diagonal<pair>,pairArray2(),"diagonal",pairArray()); } dummyRecord *createDummyRecord(venv &ve, const char *name) diff --git a/Build/source/utils/asymptote/castop.h b/Build/source/utils/asymptote/castop.h index 714dfdb0bae..5d8e15e060b 100644 --- a/Build/source/utils/asymptote/castop.h +++ b/Build/source/utils/asymptote/castop.h @@ -65,15 +65,31 @@ void castString(vm::stack *s) template<class T, class S> void arrayToArray(vm::stack *s) { - vm::array *a = pop<vm::array*>(s); - checkArray(a); - size_t size=(size_t) a->size(); + vm::array *a=pop<vm::array*>(s); + size_t size=checkArray(a); vm::array *c=new vm::array(size); for(size_t i=0; i < size; i++) (*c)[i]=(S) read<T>(a,i); s->push(c); } +template<class T, class S> +void array2ToArray2(vm::stack *s) +{ + vm::array *a=pop<vm::array*>(s); + size_t size=checkArray(a); + vm::array *c=new vm::array(size); + for(size_t i=0; i < size; ++i) { + vm::array *ai=vm::read<vm::array*>(a,i); + size_t aisize=checkArray(ai); + vm::array *ci=new vm::array(aisize); + (*c)[i]=ci; + for(size_t j=0; j < aisize; ++j) + (*ci)[j]=(S) read<T>(ai,j); + } + s->push(c); +} + template<class T> void read(vm::stack *s) { diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure index 6e9d0c7fa67..06aa9ad6cd5 100755 --- a/Build/source/utils/asymptote/configure +++ b/Build/source/utils/asymptote/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for Asymptote 1.93. +# Generated by GNU Autoconf 2.63 for Asymptote 1.94. # # Report bugs to <http://sourceforge.net/projects/asymptote>. # @@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Asymptote' PACKAGE_TARNAME='asymptote' -PACKAGE_VERSION='1.93' -PACKAGE_STRING='Asymptote 1.93' +PACKAGE_VERSION='1.94' +PACKAGE_STRING='Asymptote 1.94' PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote' # Factoring default headers for most tests. @@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Asymptote 1.93 to adapt to many kinds of systems. +\`configure' configures Asymptote 1.94 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1355,7 +1355,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Asymptote 1.93:";; + short | recursive ) echo "Configuration of Asymptote 1.94:";; esac cat <<\_ACEOF @@ -1465,7 +1465,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Asymptote configure 1.93 +Asymptote configure 1.94 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1479,7 +1479,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Asymptote $as_me 1.93, which was +It was created by Asymptote $as_me 1.94, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -12019,7 +12019,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Asymptote $as_me 1.93, which was +This file was extended by Asymptote $as_me 1.94, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12078,7 +12078,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Asymptote config.status 1.93 +Asymptote config.status 1.94 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/Build/source/utils/asymptote/configure.ac b/Build/source/utils/asymptote/configure.ac index d8bc1bd75c7..505fa340808 100644 --- a/Build/source/utils/asymptote/configure.ac +++ b/Build/source/utils/asymptote/configure.ac @@ -3,7 +3,7 @@ # this file. AC_PREREQ(2) -AC_INIT([Asymptote],[1.93],[http://sourceforge.net/projects/asymptote]) +AC_INIT([Asymptote],[1.94],[http://sourceforge.net/projects/asymptote]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf Binary files differindex f56d59f0642..ee2b6692e8f 100644 --- a/Build/source/utils/asymptote/doc/CAD.pdf +++ b/Build/source/utils/asymptote/doc/CAD.pdf diff --git a/Build/source/utils/asymptote/doc/FAQ/Makefile b/Build/source/utils/asymptote/doc/FAQ/Makefile index cbd990801d1..de93f0d7fcf 100644 --- a/Build/source/utils/asymptote/doc/FAQ/Makefile +++ b/Build/source/utils/asymptote/doc/FAQ/Makefile @@ -34,8 +34,8 @@ install-info: faq install-prebuilt uninstall: uninstall-all uninstall-all: - -cd $(docdir)/asy-faq.html; rm -rf *.html - -cd $(docdir); rmdir asy-faq.html; rm asy-faq.ascii + -cd $(docdir)/asy-faq.html && rm -rf *.html + -cd $(docdir) && rmdir asy-faq.html && rm asy-faq.ascii -install-info --remove --infodir=$(infodir) asy-faq.info -rm -f $(infodir)/asy-faq.info diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info index 742e958e79b..32b8053f241 100644 --- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info +++ b/Build/source/utils/asymptote/doc/FAQ/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 - 16 Apr 2010 + 04 May 2010 This is the list of Frequently Asked Questions about Asymptote (asy). diff --git a/Build/source/utils/asymptote/doc/Makefile.in b/Build/source/utils/asymptote/doc/Makefile.in index e15881d1230..7c5df2f878c 100644 --- a/Build/source/utils/asymptote/doc/Makefile.in +++ b/Build/source/utils/asymptote/doc/Makefile.in @@ -17,13 +17,13 @@ all: doc dvi: doc asymptote.dvi doc: $(DOCFILES) asy.1 faq latexusage.eps - cd png; $(MAKE) all + cd png && $(MAKE) all man: $(DOCFILES) asy.1 - cd png; $(MAKE) asymptote.info + cd png && $(MAKE) asymptote.info faq: - cd FAQ; $(MAKE) faq + cd FAQ && $(MAKE) faq %.eps: %.asy $(ASY) -f eps $< @@ -66,12 +66,12 @@ CAD.pdf: CAD.tex CAD1.eps dvipdf CAD clean: FORCE - -rm -f $(ASYFILES:.asy=.pdf) $(DOCFILES) + -rm -f $(ASYFILES:.asy=.pdf) -rm -f *.eps latexusage.{asy,dvi,eps,log,aux,*.eps} - -rm -f {asymptote,asymptote_}.{aux,cp,cps,dvi,fn,info,ky,log,pg,pdf,toc,tp,vr} + -rm -f {asymptote,asymptote_}.{aux,cp,cps,dvi,fn,info,ky,log,pg,toc,tp,vr} -rm -f asymptote_.texi - -rm -f CAD.{aux,dvi,log,pdf,toc} - cd png; $(MAKE) clean + -rm -f CAD.{aux,dvi,log,toc} + cd png && $(MAKE) clean install-man: ${INSTALL} -d -m 755 $(docdir) $(mandir)/man1 @@ -79,28 +79,29 @@ install-man: ${INSTALL} -p -m 644 $(MANFILES) $(mandir)/man1 install: man faq install-man - cd png; $(MAKE) install - cd FAQ; $(MAKE) install + cd png && $(MAKE) install + cd FAQ && $(MAKE) install install-prebuilt: install-man touch png/asymptote.info - cd png; $(MAKE) install - cd FAQ; $(MAKE) install-prebuilt + cd png && $(MAKE) install + cd FAQ && $(MAKE) install-prebuilt install-all: $(DOCFILES) asy.1 faq latexusage.eps install-man - cd png; $(MAKE) install-all - cd FAQ; $(MAKE) install-info + cd png && $(MAKE) install-all + cd FAQ && $(MAKE) install-info uninstall: uninstall-all uninstall-all: - cd png; $(MAKE) uninstall - cd FAQ; $(MAKE) uninstall - -cd $(mandir)/man1; rm -f $(MANFILES) + cd png && $(MAKE) uninstall + cd FAQ && $(MAKE) uninstall + -cd $(mandir)/man1 && rm -f $(MANFILES) -rm -f $(addprefix $(docdir)/,$(DOCFILES)) distclean: FORCE clean - -rm -f version.texi Makefile - cd png; make distclean - cd FAQ; make distclean + -rm -f version.texi Makefile + -rm -f $(DOCFILES) + cd png && make distclean + cd FAQ && make distclean FORCE: diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf Binary files differindex 2e88dc27375..699a02f61b2 100644 --- a/Build/source/utils/asymptote/doc/asymptote.pdf +++ b/Build/source/utils/asymptote/doc/asymptote.pdf diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index 409cf49447e..4a08d9c58ea 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -1867,7 +1867,7 @@ returns @code{z.y}; @cindex @code{realmult} returns the element-by-element product @code{(z.x*w.x,z.y*w.y)}; -@item real dot(pair z, pair w) +@item real dot(explicit pair z, explicit pair w) @cindex @code{dot} returns the dot product @code{z.x*w.x+z.y*w.y}; @@ -2307,6 +2307,12 @@ returns the direction of the tangent to path @code{p} at the point between node @code{floor(t)} and @code{floor(t)+1} corresponding to the cubic spline parameter @code{t-floor(t)} (@pxref{Bezier curves}). +@item pair dir(path p) +returns dir(p,length(p)). + +@item pair dir(path p, path g) +returns unit(dir(p)+dir(g)). + @cindex @code{accel} @item pair accel(path p, int t, int sign=0); If @code{sign < 0}, return the acceleration of the incoming path @@ -3377,7 +3383,7 @@ Here @code{filltype} specifies one of the following fill types: Fill the interior and draw the boundary. @item FillDraw(real xmargin=0, real ymargin=xmargin, pen fillpen=nullpen, - @code{pen drawpen=nullpen);} + @code{pen drawpen=nullpen)} @cindex @code{nullpen} If @code{fillpen} is @code{nullpen}, fill with the drawing pen; otherwise fill with pen @code{fillpen}. @@ -3421,6 +3427,11 @@ Clip the region and surrounding margins @code{xmargin} and @code{ymargin}. Fill varying radially from @code{penc} at the center of the bounding box to @code{penr} at the edge. +@cindex @code{RadialShadeDraw} +@item RadialShadeDraw(real xmargin=0, real ymargin=xmargin, pen penc, + @code{pen penr, pen drawpen=nullpen)} +Fill with RadialShade and draw the boundary. + @end table @cindex bounding box @@ -4989,8 +5000,8 @@ cyclic array never leads to out-of-bounds errors or array resizing. The member @code{A.keys} evaluates to an array of integers containing the indices of initialized entries in the array in ascending order. Hence, for an array of length @code{n} with all entries initialized, @code{A.keys} evaluates -to the array of integers from @code{0} to @code{n-1} inclusive. A new keys -array is produced each time @code{A.keys} is evaluated. +to @code{@{0,1,...,n-1@}}. A new keys array is produced each time +@code{A.keys} is evaluated. The functions @code{A.push} and @code{A.append} append their arguments onto the end of the array, while @code{A.insert(int i ... T[] x)} @@ -5222,10 +5233,15 @@ write(); write(f/n); @end verbatim -@cindex @code{solve} +@cindex @code{dot} @item real dot(real[] a, real[] b) returns the dot product of the vectors @code{a} and @code{b}. +@cindex @code{dot} +@item pair dot(pair[] a, pair[] b) +returns the complex dot product @code{sum(a*conj(b))} of the vectors +@code{a} and @code{b}. + @anchor{tridiagonal} @cindex @code{tridiagonal} @item real[] tridiagonal(real[] a, real[] b, real[] c, real[] f); @@ -6054,7 +6070,7 @@ sizing of pictures. @section @code{math} @cindex @code{math} This package extends @code{Asymptote}'s mathematical capabilities with -matrix arithmetic and intersection algorithms: +useful functions such as @table @code @@ -6077,10 +6093,59 @@ respectively. If the planes are parallel, return @code{(infinity,infinity,infinity)}. @cindex @code{quarticroots} -@item @code{pair[] quarticroots(real a, real b, real c, real d, real e);} +@item pair[] quarticroots(real a, real b, real c, real d, real e); returns the four complex roots of the quartic equation @math{ax^4+bx^3+cx^2+dx+e=0}. +@cindex @code{fft} +@item pair[][] fft(pair[][] a, int sign=1) +returns the two-dimensional Fourier transform of a using the given +@code{sign}. + +@cindex @code{time} +@item real time(path g, real x, int n=0) +returns the @code{n}th intersection time of path @code{g} with the vertical +line through x. + +@cindex @code{time} +@item real time(path g, explicit pair z, int n=0) +returns the @code{n}th intersection time of path @code{g} with the horizontal +line through @code{(0,z.y)}. + +@cindex @code{value} +@item real value(path g, real x, int n=0) +returns the @code{n}th @code{y} value of @code{g} at @code{x}. + +@cindex @code{value} +@item real value(path g, real x, int n=0) +returns the @code{n}th @code{x} value of @code{g} at @code{y=z.y}. + +@cindex @code{slope} +@item real slope(path g, real x, int n=0) +returns the @code{n}th slope of @code{g} at @code{x}. + +@cindex @code{slope} +@item real slope(path g, explicit pair z, int n=0) +returns the @code{n}th slope of @code{g} at @code{y=z.y}. + +@cindex @code{segment} +int[][] segment(bool[] b) +returns the indices of consecutive true-element segments of bool[] @code{b}. + +@cindex @code{partialsum} +@item real[] partialsum(real[] a) +returns the partial sums of a real array @code{a}. + +@cindex @code{partialsum} +@item real[] partialsum(real[] a, real[] dx) +returns the partial @code{dx}-weighted sums of a real array @code{a}. + +@cindex @code{increasing} +@item bool increasing(real[] a, bool strict=false) +returns, if @code{strict=false}, whether @code{i > j} implies +@code{a[i] >= a[j]}, or if @code{strict=true}, whether @code{i > j} implies +implies @code{a[i] > a[j]}. + @end table @node interpolate @@ -7706,6 +7771,17 @@ to the viewport dimensions corresponding to the usual two-dimensional picture @code{size} parameters. The global pair @code{viewportmargin} may be used to add horizontal and vertical margins to the viewport dimensions. Alternatively, a minimum @code{viewportsize} may be specified. +A 3D picture @code{pic} can be explicitly fit to a 3D frame by calling +@cindex @code{fit3} +@verbatim +frame pic.fit3(projection P=currentprojection); +@end verbatim +@noindent +and then added to picture @code{dest} about @code{position} with +@cindex @code{add} +@verbatim +void add(picture dest=currentpicture, frame src, triple position=(0,0,0)); +@end verbatim @cindex @code{O} @cindex @code{X} @@ -7870,23 +7946,46 @@ projection TopView=orthographic(Z,showtarget=true); @end verbatim @noindent The function +@cindex @code{addViews} @verbatim -void addViews(picture dest=currentpicture, picture src, bool group=true, - filltype filltype=NoFill); +void addViews(picture dest=currentpicture, picture src, + projection[][] views=SixViewsUS, + bool group=true, filltype filltype=NoFill); @end verbatim @noindent -adds picture @code{pic} as seen with @code{FrontView} aligned above the -projection @code{TopView} and to the right of the projection @code{RightView}. -Alternatively, the function +adds to picture @code{dest} an array of views of picture @code{src} +using the layout projection[][] @code{views}. The default layout +@code{SixViewsUS} aligns the projection @code{FrontView} below +@code{TopView} and above @code{BottomView}, to the right of +@code{LeftView} and left of @code{RightView} and @code{BackView}. +The predefined layouts are: +@cindex @code{ThreeViewsUS} +@cindex @code{SixViewsUS} +@cindex @code{ThreeViewsFR} +@cindex @code{SixViewsFR} +@cindex @code{ThreeViews} +@cindex @code{SixViews} @verbatim -void addAllViews(picture dest=currentpicture, picture src, - real xmargin=0, real ymargin=xmargin, - bool group=true, filltype filltype=NoFill); +projection[][] ThreeViewsUS={{TopView}, + {FrontView,RightView}}; + +projection[][] SixViewsUS={{null,TopView}, + {LeftView,FrontView,RightView,BackView}, + {null,BottomView}}; + +projection[][] ThreeViewsFR={{RightView,FrontView}, + {null,TopView}}; + +projection[][] SixViewsFR={{null,BottomView}, + {RightView,FrontView,LeftView,BackView}, + {null,TopView}}; + +projection[][] ThreeViews={{FrontView,TopView,RightView}}; + +projection[][] SixViews={{FrontView,TopView,RightView}, + {BackView,BottomView,LeftView}}; + @end verbatim -@noindent -may be used to exhibit all six standard views, with FrontView, -TopView, RightView in the upper row and BackView, BottomView, LeftView -in the lower row. A triple or path3 can be projected to a pair or path, with @code{project(triple, projection P=currentprojection)} or @@ -9420,12 +9519,14 @@ Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: nonintegral gettriple enablerepo hexidecimal XeLaTeX xelatex @c LocalWords: dvipdfmx autoadjust viewportsize viewportwidth viewportheight @c LocalWords: subregions nonsimply functionshade shader floatingdisk TopView -@c LocalWords: functionshading maxlength LeftView odetest -@c LocalWords: vectorfieldsphere RightView FrontView BackView BottomView +@c LocalWords: functionshading maxlength LeftView odetest RadialShadeDraw CLZ +@c LocalWords: vectorfieldsphere RightView FrontView BackView BottomView CTZ @c LocalWords: addViews outprefix addAllViews xsplinetype ysplinetype rotateX @c LocalWords: usplinetype vsplinetype leftbutton middlebutton rightbutton @c LocalWords: rotateY rotateZ wheelup zoomin wheeldown zoomout TeXLive @c LocalWords: viewportshift signedint signedness psview multiplatform nowarn @c LocalWords: singlereal singleint writeoverloaded tubegranularity dvisvg @c LocalWords: bigdiagonal autobillboard dvisvgm maxtiles hyperrefOptions -@c LocalWords: setpagesize pdfborder controlsystem +@c LocalWords: setpagesize pdfborder controlsystem OmitTickInterval SixViews +@c LocalWords: OmitTickIntervals tickmodifiers autorotated SixViewsUS +@c LocalWords: ThreeViewsUS ThreeViewsFR SixViewsFR ThreeViews partialsum diff --git a/Build/source/utils/asymptote/doc/png/Makefile.in b/Build/source/utils/asymptote/doc/png/Makefile.in index 1d96e88a2b5..4c01b40d2b7 100644 --- a/Build/source/utils/asymptote/doc/png/Makefile.in +++ b/Build/source/utils/asymptote/doc/png/Makefile.in @@ -10,7 +10,7 @@ INSTALL = @INSTALL@ all: html info %.png: ../%.asy - cd ..; $(ASY) -f png -o png/ $(notdir $<) + cd .. && $(ASY) -f png -o png/ $(notdir $<) latexusage.png: ../latexusage.eps convert -alpha Off -density 144x144 +antialias -geometry 50%x \ @@ -45,6 +45,6 @@ install-all: all install uninstall: -install-info --remove --infodir=$(infodir) asymptote.info - -cd $(infodir)/asymptote; rm -f asymptote.info *.png + -cd $(infodir)/asymptote && rm -f asymptote.info *.png -rmdir -f $(infodir)/asymptote FORCE: diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info index 7f33757b624..aa24a4f977a 100644 --- a/Build/source/utils/asymptote/doc/png/asymptote.info +++ b/Build/source/utils/asymptote/doc/png/asymptote.info @@ -1,7 +1,7 @@ This is asymptote.info, produced by makeinfo version 4.13 from ../asymptote.texi. -This file documents `Asymptote', version 1.93. +This file documents `Asymptote', version 1.94. `http://asymptote.sourceforge.net' @@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir) Asymptote ********* -This file documents `Asymptote', version 1.93. +This file documents `Asymptote', version 1.94. `http://asymptote.sourceforge.net' @@ -1483,7 +1483,7 @@ user-defined types): `pair realmult(pair z, pair w)' returns the element-by-element product `(z.x*w.x,z.y*w.y)'; - `real dot(pair z, pair w)' + `real dot(explicit pair z, explicit pair w)' returns the dot product `z.x*w.x+z.y*w.y'; `pair minbound(pair z, pair w)' @@ -1843,6 +1843,12 @@ File: asymptote.info, Node: Paths and guides, Next: Pens, Prev: Data types, between node `floor(t)' and `floor(t)+1' corresponding to the cubic spline parameter `t-floor(t)' (*note Bezier curves::). + `pair dir(path p)' + returns dir(p,length(p)). + + `pair dir(path p, path g)' + returns unit(dir(p)+dir(g)). + `pair accel(path p, int t, int sign=0);' If `sign < 0', return the acceleration of the incoming path `p' at node `t'; if `sign > 0', return the acceleration of @@ -2676,7 +2682,7 @@ File: asymptote.info, Node: Frames and pictures, Next: Files, Prev: Transform Fill the interior and draw the boundary. `FillDraw(real xmargin=0, real ymargin=xmargin, pen fillpen=nullpen,' - `pen drawpen=nullpen);' If `fillpen' is `nullpen', fill with + `pen drawpen=nullpen)' If `fillpen' is `nullpen', fill with the drawing pen; otherwise fill with pen `fillpen'. If `drawpen' is `nullpen', draw the boundary with `fillpen'; otherwise with `drawpen'. An optional margin of `xmargin' and @@ -2712,6 +2718,10 @@ File: asymptote.info, Node: Frames and pictures, Next: Files, Prev: Transform Fill varying radially from `penc' at the center of the bounding box to `penr' at the edge. + `RadialShadeDraw(real xmargin=0, real ymargin=xmargin, pen penc,' + `pen penr, pen drawpen=nullpen)' Fill with RadialShade and + draw the boundary. + For example, to draw a bounding box around a picture with a 0.25 cm margin and output the resulting frame, use the command: shipout(bbox(0.25cm)); @@ -3890,8 +3900,8 @@ array never leads to out-of-bounds errors or array resizing. The member `A.keys' evaluates to an array of integers containing the indices of initialized entries in the array in ascending order. Hence, for an array of length `n' with all entries initialized, `A.keys' -evaluates to the array of integers from `0' to `n-1' inclusive. A new -keys array is produced each time `A.keys' is evaluated. +evaluates to `{0,1,...,n-1}'. A new keys array is produced each time +`A.keys' is evaluated. The functions `A.push' and `A.append' append their arguments onto the end of the array, while `A.insert(int i ... T[] x)' inserts `x' @@ -4087,6 +4097,10 @@ of type `T[]'. `real dot(real[] a, real[] b)' returns the dot product of the vectors `a' and `b'. +`pair dot(pair[] a, pair[] b)' + returns the complex dot product `sum(a*conj(b))' of the vectors + `a' and `b'. + `real[] tridiagonal(real[] a, real[] b, real[] c, real[] f);' Solve the periodic tridiagonal problem L`x'=`f' and return the solution `x', where `f' is an n vector and L is the n \times n @@ -4881,7 +4895,7 @@ File: asymptote.info, Node: math, Next: interpolate, Prev: simplex, Up: Base ========== This package extends `Asymptote''s mathematical capabilities with -matrix arithmetic and intersection algorithms: +useful functions such as `void drawline(picture pic=currentpicture, pair P, pair Q, pen p=currentpen);' draw the visible portion of the (infinite) line going through `P' @@ -4896,10 +4910,48 @@ matrix arithmetic and intersection algorithms: `n0' and `n1' passing through points `P0' and `P1', respectively. If the planes are parallel, return `(infinity,infinity,infinity)'. -``pair[] quarticroots(real a, real b, real c, real d, real e);'' +`pair[] quarticroots(real a, real b, real c, real d, real e);' returns the four complex roots of the quartic equation ax^4+bx^3+cx^2+dx+e=0. +`pair[][] fft(pair[][] a, int sign=1)' + returns the two-dimensional Fourier transform of a using the given + `sign'. + +`real time(path g, real x, int n=0)' + returns the `n'th intersection time of path `g' with the vertical + line through x. + +`real time(path g, explicit pair z, int n=0)' + returns the `n'th intersection time of path `g' with the horizontal + line through `(0,z.y)'. + +`real value(path g, real x, int n=0)' + returns the `n'th `y' value of `g' at `x'. + +`real value(path g, real x, int n=0)' + returns the `n'th `x' value of `g' at `y=z.y'. + +`real slope(path g, real x, int n=0)' + returns the `n'th slope of `g' at `x'. + +`real slope(path g, explicit pair z, int n=0)' + returns the `n'th slope of `g' at `y=z.y'. + + int[][] segment(bool[] b) returns the indices of consecutive + true-element segments of bool[] `b'. + +`real[] partialsum(real[] a)' + returns the partial sums of a real array `a'. + +`real[] partialsum(real[] a, real[] dx)' + returns the partial `dx'-weighted sums of a real array `a'. + +`bool increasing(real[] a, bool strict=false)' + returns, if `strict=false', whether `i > j' implies `a[i] >= + a[j]', or if `strict=true', whether `i > j' implies implies `a[i] + > a[j]'. + File: asymptote.info, Node: interpolate, Next: geometry, Prev: math, Up: Base modules @@ -6749,7 +6801,11 @@ The result is then fit with another application of deferred drawing to the viewport dimensions corresponding to the usual two-dimensional picture `size' parameters. The global pair `viewportmargin' may be used to add horizontal and vertical margins to the viewport dimensions. -Alternatively, a minimum `viewportsize' may be specified. +Alternatively, a minimum `viewportsize' may be specified. A 3D picture +`pic' can be explicitly fit to a 3D frame by calling +frame pic.fit3(projection P=currentprojection); + and then added to picture `dest' about `position' with +void add(picture dest=currentpicture, frame src, triple position=(0,0,0)); For convenience, the `three' module defines `O=(0,0,0)', `X=(1,0,0)', `Y=(0,1,0)', and `Z=(0,0,1)', along with a unitcircle in @@ -6865,18 +6921,33 @@ projection FrontView=orthographic(-Y,showtarget=true); projection BackView=orthographic(Y,showtarget=true); projection BottomView=orthographic(-Z,showtarget=true); projection TopView=orthographic(Z,showtarget=true); - The function -void addViews(picture dest=currentpicture, picture src, bool group=true, - filltype filltype=NoFill); - adds picture `pic' as seen with `FrontView' aligned above the -projection `TopView' and to the right of the projection `RightView'. -Alternatively, the function -void addAllViews(picture dest=currentpicture, picture src, - real xmargin=0, real ymargin=xmargin, - bool group=true, filltype filltype=NoFill); - may be used to exhibit all six standard views, with FrontView, -TopView, RightView in the upper row and BackView, BottomView, LeftView -in the lower row. + The function +void addViews(picture dest=currentpicture, picture src, + projection[][] views=SixViewsUS, + bool group=true, filltype filltype=NoFill); + adds to picture `dest' an array of views of picture `src' using the +layout projection[][] `views'. The default layout `SixViewsUS' aligns +the projection `FrontView' below `TopView' and above `BottomView', to +the right of `LeftView' and left of `RightView' and `BackView'. The +predefined layouts are: +projection[][] ThreeViewsUS={{TopView}, + {FrontView,RightView}}; + +projection[][] SixViewsUS={{null,TopView}, + {LeftView,FrontView,RightView,BackView}, + {null,BottomView}}; + +projection[][] ThreeViewsFR={{RightView,FrontView}, + {null,TopView}}; + +projection[][] SixViewsFR={{null,BottomView}, + {RightView,FrontView,LeftView,BackView}, + {null,TopView}}; + +projection[][] ThreeViews={{FrontView,TopView,RightView}}; + +projection[][] SixViews={{FrontView,TopView,RightView}, + {BackView,BottomView,LeftView}}; A triple or path3 can be projected to a pair or path, with `project(triple, projection P=currentprojection)' or `project(path3, @@ -8321,7 +8392,7 @@ Index * 2D graphs: graph. (line 6) * 3D graphs: graph3. (line 6) * 3D grids: grid3. (line 6) -* 3D PostScript: three. (line 548) +* 3D PostScript: three. (line 567) * 3D rendering: Compiling from UNIX source. (line 16) * :: Arithmetic & logical. @@ -8350,8 +8421,8 @@ Index * abs <1>: Mathematical functions. (line 35) * abs: Data types. (line 60) -* accel <1>: three. (line 478) -* accel: Paths and guides. (line 109) +* accel <1>: three. (line 497) +* accel: Paths and guides. (line 115) * access: Import. (line 6) * acknowledgments: Credits. (line 6) * aCos: Mathematical functions. @@ -8360,7 +8431,9 @@ Index (line 6) * acosh: Mathematical functions. (line 6) -* add: Frames and pictures. (line 192) +* add <1>: three. (line 266) +* add: Frames and pictures. (line 196) +* addViews: three. (line 383) * adjust: Pens. (line 115) * Ai: Mathematical functions. (line 48) @@ -8372,7 +8445,7 @@ Index * alias: Structures. (line 54) * align: Options. (line 166) * Align: label. (line 12) -* all: Arrays. (line 328) +* all: Arrays. (line 332) * Allow: Pens. (line 327) * AND: Arithmetic & logical. (line 80) @@ -8389,17 +8462,17 @@ Index (line 16) * append <1>: Arrays. (line 39) * append: Files. (line 35) -* arc: three. (line 274) +* arc: three. (line 278) * Arc: Paths and guides. (line 32) * arc: Paths and guides. (line 22) * ArcArrow: draw. (line 26) -* ArcArrow3: three. (line 521) +* ArcArrow3: three. (line 540) * ArcArrows: draw. (line 26) -* ArcArrows3: three. (line 521) -* arclength <1>: three. (line 478) -* arclength: Paths and guides. (line 136) -* arctime <1>: three. (line 478) -* arctime: Paths and guides. (line 140) +* ArcArrows3: three. (line 540) +* arclength <1>: three. (line 497) +* arclength: Paths and guides. (line 142) +* arctime <1>: three. (line 497) +* arctime: Paths and guides. (line 146) * arguments: Default arguments. (line 6) * arithmetic operators: Arithmetic & logical. (line 6) @@ -8410,10 +8483,10 @@ Index * Arrow: draw. (line 26) * arrow: Drawing commands. (line 31) * arrow keys: Tutorial. (line 35) -* Arrow3: three. (line 521) +* Arrow3: three. (line 540) * Arrows: draw. (line 26) * arrows: draw. (line 26) -* Arrows3: three. (line 521) +* Arrows3: three. (line 540) * as: Import. (line 70) * aSin: Mathematical functions. (line 20) @@ -8441,7 +8514,7 @@ Index * atleast: Bezier curves. (line 56) * attach <1>: graph. (line 415) * attach: LaTeX usage. (line 32) -* autoadjust: three. (line 345) +* autoadjust: three. (line 349) * autoimport: Options. (line 109) * automatic scaling: graph. (line 682) * axialshade: fill. (line 43) @@ -8449,12 +8522,12 @@ Index * axis: graph. (line 880) * azimuth: Data types. (line 124) * babel: babel. (line 6) -* background color: Frames and pictures. (line 164) -* BackView: three. (line 372) +* background color: Frames and pictures. (line 168) +* BackView: three. (line 376) * Bar: draw. (line 19) -* Bar3: three. (line 521) +* Bar3: three. (line 540) * Bars: draw. (line 19) -* Bars3: three. (line 521) +* Bars3: three. (line 540) * barsize: draw. (line 19) * base modules: Base modules. (line 6) * basealign: Pens. (line 168) @@ -8462,18 +8535,18 @@ Index * batch mode: Tutorial. (line 6) * beep: Data types. (line 340) * BeginArcArrow: draw. (line 26) -* BeginArcArrow3: three. (line 521) +* BeginArcArrow3: three. (line 540) * BeginArrow: draw. (line 26) -* BeginArrow3: three. (line 521) +* BeginArrow3: three. (line 540) * BeginBar: draw. (line 19) -* BeginBar3: three. (line 521) +* BeginBar3: three. (line 540) * BeginDotMargin: draw. (line 42) -* BeginDotMargin3: three. (line 537) +* BeginDotMargin3: three. (line 556) * BeginMargin: draw. (line 42) -* BeginMargin3: three. (line 537) +* BeginMargin3: three. (line 556) * BeginPenMargin: draw. (line 42) -* BeginPenMargin2: three. (line 537) -* BeginPenMargin3: three. (line 537) +* BeginPenMargin2: three. (line 556) +* BeginPenMargin3: three. (line 556) * BeginPoint: label. (line 57) * Bessel: Mathematical functions. (line 48) @@ -8485,7 +8558,7 @@ Index (line 48) * Bi_deriv: Mathematical functions. (line 48) -* Billboard: three. (line 448) +* Billboard: three. (line 467) * binary format: Files. (line 70) * binary operators: Arithmetic & logical. (line 6) @@ -8510,11 +8583,11 @@ Index (line 6) * Bottom: graph. (line 134) * BottomTop: graph. (line 140) -* BottomView: three. (line 372) -* bounding box: Frames and pictures. (line 164) +* BottomView: three. (line 376) +* bounding box: Frames and pictures. (line 168) * Bounds: graph3. (line 20) * boutput: Files. (line 70) -* box <1>: three. (line 296) +* box <1>: three. (line 300) * box: Frames and pictures. (line 22) * bp: Tutorial. (line 24) * break: Programming. (line 29) @@ -8522,7 +8595,7 @@ Index * brick: Pens. (line 251) * broken axis: graph. (line 783) * bug reports: Help. (line 23) -* buildcycle: Paths and guides. (line 249) +* buildcycle: Paths and guides. (line 255) * Button-1: GUI. (line 6) * Button-2: GUI. (line 6) * BWRainbow: palette. (line 15) @@ -8536,7 +8609,7 @@ Index * cd: Files. (line 24) * ceil: Mathematical functions. (line 26) -* center: three. (line 329) +* center: three. (line 333) * Center: label. (line 62) * checker: Pens. (line 251) * Chinese: unicode. (line 12) @@ -8545,7 +8618,7 @@ Index * Ci: Mathematical functions. (line 48) * circle <1>: flowchart. (line 64) -* circle: three. (line 270) +* circle: three. (line 274) * Circle: Paths and guides. (line 17) * circle: Paths and guides. (line 10) * circlebarframe: markers. (line 18) @@ -8566,7 +8639,7 @@ Index * colorless: Pens. (line 54) * colors: Pens. (line 51) * comma: Files. (line 58) -* comma-separated-value mode: Arrays. (line 361) +* comma-separated-value mode: Arrays. (line 365) * command-line options <1>: Options. (line 6) * command-line options: Configuring. (line 83) * comment character: Files. (line 15) @@ -8591,7 +8664,7 @@ Index * contour3: contour3. (line 6) * controls <1>: three. (line 6) * controls: Bezier curves. (line 45) -* controlSpecifier: Paths and guides. (line 373) +* controlSpecifier: Paths and guides. (line 379) * convert <1>: Options. (line 141) * convert <2>: animation. (line 6) * convert <3>: Files. (line 150) @@ -8612,23 +8685,23 @@ Index * cross: Data types. (line 167) * crossframe: markers. (line 23) * crosshatch: Pens. (line 267) -* csv: Arrays. (line 361) +* csv: Arrays. (line 365) * CTZ: Arithmetic & logical. (line 80) -* cubicroots: Arrays. (line 317) +* cubicroots: Arrays. (line 321) * curl <1>: three. (line 6) * curl: Bezier curves. (line 63) -* curlSpecifier: Paths and guides. (line 385) +* curlSpecifier: Paths and guides. (line 391) * currentpen: Pens. (line 6) -* currentprojection: three. (line 369) +* currentprojection: three. (line 373) * curve: slopefield. (line 20) * custom axis types: graph. (line 144) * custom mark routine: graph. (line 576) * custom tick locations: graph. (line 249) -* cut: Paths and guides. (line 231) +* cut: Paths and guides. (line 237) * cycle <1>: three. (line 6) * cycle: Tutorial. (line 73) -* cyclic <1>: three. (line 478) +* cyclic <1>: three. (line 497) * cyclic <2>: Arrays. (line 39) * cyclic: Paths and guides. (line 74) * Cyrillic: unicode. (line 7) @@ -8644,7 +8717,7 @@ Index * default arguments: Default arguments. (line 6) * defaultformat: graph. (line 175) * DefaultHead: draw. (line 26) -* DefaultHead3: three. (line 521) +* DefaultHead3: three. (line 540) * defaultpen: Pens. (line 46) * deferred drawing: simplex. (line 6) * Degrees: Mathematical functions. @@ -8655,25 +8728,26 @@ Index * delete <1>: Arrays. (line 39) * delete: Files. (line 145) * description: Description. (line 6) -* diagonal: Arrays. (line 302) +* diagonal: Arrays. (line 306) * diamond: flowchart. (line 57) -* dimension: Arrays. (line 366) -* dir <1>: three. (line 478) +* dimension: Arrays. (line 370) +* dir <1>: three. (line 497) * dir <2>: Paths and guides. (line 98) * dir <3>: Data types. (line 85) * dir: Search paths. (line 10) * direction specifier: Bezier curves. (line 6) * directory: Files. (line 24) -* dirSpecifier: Paths and guides. (line 367) -* dirtime: Paths and guides. (line 146) +* dirSpecifier: Paths and guides. (line 373) +* dirtime: Paths and guides. (line 152) * display: Configuring. (line 67) * do: Programming. (line 29) -* dot <1>: Data types. (line 98) +* dot <1>: Arrays. (line 262) +* dot <2>: Data types. (line 98) * dot: draw. (line 83) * DotMargin: draw. (line 42) -* DotMargin3: three. (line 537) +* DotMargin3: three. (line 556) * DotMargins: draw. (line 42) -* DotMargins3: three. (line 537) +* DotMargins3: three. (line 556) * dotted: Pens. (line 95) * double deferred drawing: three. (line 251) * double precision: Files. (line 70) @@ -8700,28 +8774,28 @@ Index * else: Programming. (line 8) * emacs: Editing modes. (line 6) * embed: embed. (line 6) -* Embedded: three. (line 448) +* Embedded: three. (line 467) * empty: Frames and pictures. (line 7) * EndArcArrow: draw. (line 26) -* EndArcArrow3: three. (line 521) +* EndArcArrow3: three. (line 540) * EndArrow: draw. (line 26) -* EndArrow3: three. (line 521) +* EndArrow3: three. (line 540) * EndBar: draw. (line 19) -* EndBar3: three. (line 521) +* EndBar3: three. (line 540) * EndDotMargin: draw. (line 42) -* EndDotMargin3: three. (line 537) +* EndDotMargin3: three. (line 556) * endl: Files. (line 58) * EndMargin: draw. (line 42) -* EndMargin3: three. (line 537) +* EndMargin3: three. (line 556) * EndPenMargin: draw. (line 42) -* EndPenMargin2: three. (line 537) -* EndPenMargin3: three. (line 537) +* EndPenMargin2: three. (line 556) +* EndPenMargin3: three. (line 556) * EndPoint: label. (line 57) * envelope: Frames and pictures. (line 22) * environment variables: Configuring. (line 87) -* eof <1>: Arrays. (line 343) +* eof <1>: Arrays. (line 347) * eof: Files. (line 88) -* eol <1>: Arrays. (line 343) +* eol <1>: Arrays. (line 347) * eol: Files. (line 88) * EPS <1>: Options. (line 141) * EPS: label. (line 80) @@ -8752,19 +8826,20 @@ Index (line 48) * extendcap: Pens. (line 129) * extension <1>: MetaPost. (line 10) -* extension: Paths and guides. (line 226) +* extension: Paths and guides. (line 232) * external: embed. (line 28) -* extrude: three. (line 472) +* extrude: three. (line 491) * F: Mathematical functions. (line 48) * fabs: Mathematical functions. (line 6) -* face: three. (line 556) +* face: three. (line 575) * factorial: Mathematical functions. (line 39) * Fedora: UNIX binary distributions. (line 15) * feynman: feynman. (line 6) +* fft <1>: math. (line 26) * fft: Arrays. (line 249) * FFTW: Compiling from UNIX source. (line 58) @@ -8781,8 +8856,9 @@ Index * fillrule: Pens. (line 152) * find <1>: Arrays. (line 159) * find: Data types. (line 224) -* firstcut: Paths and guides. (line 241) +* firstcut: Paths and guides. (line 247) * fit: Frames and pictures. (line 103) +* fit3: three. (line 264) * fix-cm: Pens. (line 178) * fixedscaling: Frames and pictures. (line 74) * floor: Mathematical functions. @@ -8803,7 +8879,7 @@ Index * freeglut: Compiling from UNIX source. (line 16) * from: Import. (line 17) -* FrontView: three. (line 372) +* FrontView: three. (line 376) * function declarations: Functions. (line 67) * function shading: fill. (line 96) * Function shading: fill. (line 96) @@ -8847,7 +8923,7 @@ Index * GUI: GUI. (line 6) * GUI installation: GUI installation. (line 6) * GUI usage: GUI usage. (line 6) -* guide: Paths and guides. (line 294) +* guide: Paths and guides. (line 300) * guide3: three. (line 6) * hatch: Pens. (line 267) * height: LaTeX usage. (line 32) @@ -8860,14 +8936,14 @@ Index * hex: Data types. (line 280) * hexidecimal <1>: Pens. (line 59) * hexidecimal: Data types. (line 280) -* hidden surface removal: three. (line 556) +* hidden surface removal: three. (line 575) * histogram: Mathematical functions. (line 39) * history <1>: Interactive mode. (line 59) * history: Files. (line 138) * historylines: Interactive mode. (line 64) * HookHead: draw. (line 26) -* HookHead3: three. (line 521) +* HookHead3: three. (line 540) * Horizontal: flowchart. (line 81) * hyperrefOptions: Options. (line 128) * hypot: Mathematical functions. @@ -8877,11 +8953,11 @@ Index * i_scaled: Mathematical functions. (line 48) * iconic: three. (line 205) -* identity <1>: Arrays. (line 299) +* identity <1>: Arrays. (line 303) * identity <2>: Mathematical functions. (line 6) * identity: Transforms. (line 24) -* identity4: three. (line 408) +* identity4: three. (line 427) * if: Programming. (line 8) * IgnoreAspect: Frames and pictures. (line 58) * image: palette. (line 34) @@ -8895,6 +8971,7 @@ Index * import: Import. (line 48) * inches: Tutorial. (line 61) * including images: label. (line 80) +* increasing: math. (line 59) * inheritance: Structures. (line 189) * initialized: Arrays. (line 39) * initializers: Variable initializers. @@ -8904,34 +8981,34 @@ Index * input: Files. (line 11) * insert <1>: Arrays. (line 39) * insert: Data types. (line 235) -* inside: Paths and guides. (line 273) +* inside: Paths and guides. (line 279) * inst: Debugger. (line 36) * installation: Installation. (line 6) * int: Data types. (line 28) * integer division: Arithmetic & logical. (line 6) * interactive mode: Interactive mode. (line 6) -* interior: Paths and guides. (line 269) +* interior: Paths and guides. (line 275) * international characters: unicode. (line 6) * interp: Arithmetic & logical. (line 76) * interpolate: interpolate. (line 6) -* intersect <1>: three. (line 478) +* intersect <1>: three. (line 497) * intersect <2>: math. (line 13) -* intersect: Paths and guides. (line 175) -* intersectionpoint <1>: three. (line 478) +* intersect: Paths and guides. (line 181) +* intersectionpoint <1>: three. (line 497) * intersectionpoint <2>: math. (line 17) -* intersectionpoint: Paths and guides. (line 218) -* intersectionpoints <1>: three. (line 478) -* intersectionpoints: Paths and guides. (line 222) -* intersections <1>: three. (line 478) -* intersections: Paths and guides. (line 186) +* intersectionpoint: Paths and guides. (line 224) +* intersectionpoints <1>: three. (line 497) +* intersectionpoints: Paths and guides. (line 228) +* intersections <1>: three. (line 497) +* intersections: Paths and guides. (line 192) * InTicks: graph3. (line 34) * intMax: Data types. (line 28) * intMin: Data types. (line 28) -* inverse <1>: Arrays. (line 305) +* inverse <1>: Arrays. (line 309) * inverse: Transforms. (line 16) -* invert: three. (line 398) +* invert: three. (line 417) * invisible: Pens. (line 39) * J: Mathematical functions. (line 6) @@ -8946,7 +9023,7 @@ Index * keys: Arrays. (line 39) * keywords: Named arguments. (line 6) * Korean: unicode. (line 12) -* label: three. (line 442) +* label: three. (line 461) * Label <1>: graph. (line 342) * Label: label. (line 15) * label: clip. (line 16) @@ -8956,7 +9033,7 @@ Index * labelx: graph. (line 342) * labely: graph. (line 342) * Landscape: Frames and pictures. (line 95) -* lastcut: Paths and guides. (line 245) +* lastcut: Paths and guides. (line 251) * lasy-mode: Editing modes. (line 6) * latex: Options. (line 141) * LaTeX fonts: Pens. (line 192) @@ -8971,13 +9048,13 @@ Index * LeftRight: graph. (line 290) * LeftSide: label. (line 62) * LeftTicks: graph. (line 161) -* LeftView: three. (line 372) +* LeftView: three. (line 376) * legend <1>: graph. (line 431) * legend <2>: draw. (line 64) * legend: Drawing commands. (line 31) * Legendre: Mathematical functions. (line 48) -* length <1>: three. (line 478) +* length <1>: three. (line 497) * length <2>: Arrays. (line 39) * length <3>: Paths and guides. (line 65) * length: Data types. (line 60) @@ -8987,8 +9064,8 @@ Index * libsigsegv <1>: Help. (line 33) * libsigsegv: Functions. (line 88) * limits: graph. (line 636) -* line: Arrays. (line 343) -* line mode: Arrays. (line 343) +* line: Arrays. (line 347) +* line mode: Arrays. (line 347) * Linear: graph. (line 682) * linecap: Pens. (line 129) * linejoin: Pens. (line 138) @@ -9017,10 +9094,10 @@ Index * makepen: Pens. (line 300) * map: Arrays. (line 141) * Margin: draw. (line 42) -* Margin3: three. (line 537) +* Margin3: three. (line 556) * margins: three. (line 257) * Margins: draw. (line 42) -* Margins3: three. (line 537) +* Margins3: three. (line 556) * mark: graph. (line 484) * markangle: markers. (line 38) * marker: graph. (line 484) @@ -9030,34 +9107,34 @@ Index * math: math. (line 6) * mathematical functions: Mathematical functions. (line 6) -* max <1>: three. (line 478) +* max <1>: three. (line 497) * max <2>: Arrays. (line 228) * max <3>: Frames and pictures. (line 7) -* max: Paths and guides. (line 258) +* max: Paths and guides. (line 264) * maxbound: Data types. (line 104) * maxtile: three. (line 205) -* maxtimes: Paths and guides. (line 213) +* maxtimes: Paths and guides. (line 219) * maxviewport: three. (line 205) * MetaPost: MetaPost. (line 6) * MetaPost ... : Bezier curves. (line 67) -* MetaPost cutafter: Paths and guides. (line 246) -* MetaPost cutbefore: Paths and guides. (line 242) +* MetaPost cutafter: Paths and guides. (line 252) +* MetaPost cutbefore: Paths and guides. (line 248) * MetaPost pickup: Pens. (line 6) * MetaPost whatever: MetaPost. (line 10) * Microsoft Windows: Microsoft Windows. (line 6) * MidArcArrow: draw. (line 26) -* MidArcArrow3: three. (line 521) +* MidArcArrow3: three. (line 540) * MidArrow: draw. (line 26) -* MidArrow3: three. (line 521) -* midpoint: Paths and guides. (line 160) +* MidArrow3: three. (line 540) +* midpoint: Paths and guides. (line 166) * MidPoint: label. (line 57) -* min <1>: three. (line 478) +* min <1>: three. (line 497) * min <2>: Arrays. (line 221) * min <3>: Frames and pictures. (line 7) -* min: Paths and guides. (line 254) +* min: Paths and guides. (line 260) * minbound: Data types. (line 101) * minipage: label. (line 119) -* mintimes: Paths and guides. (line 208) +* mintimes: Paths and guides. (line 214) * miterjoin: Pens. (line 138) * miterlimit: Pens. (line 147) * mm: Tutorial. (line 61) @@ -9084,10 +9161,10 @@ Index * NoFill <1>: Frames and pictures. (line 141) * NoFill: draw. (line 26) * NoMargin: draw. (line 42) -* NoMargin3: three. (line 537) +* NoMargin3: three. (line 556) * none: Files. (line 58) * None: draw. (line 19) -* normal: three. (line 464) +* normal: three. (line 483) * nosafe: Options. (line 161) * NOT: Arithmetic & logical. (line 80) @@ -9096,13 +9173,13 @@ Index * null: Structures. (line 6) * nullpen <1>: Frames and pictures. (line 127) * nullpen: label. (line 14) -* NURBS: three. (line 349) -* O: three. (line 265) +* NURBS: three. (line 353) +* O: three. (line 269) * obj: obj. (line 9) -* oblique: three. (line 310) -* obliqueX: three. (line 318) -* obliqueY: three. (line 325) -* obliqueZ: three. (line 310) +* oblique: three. (line 314) +* obliqueX: three. (line 322) +* obliqueY: three. (line 329) +* obliqueZ: three. (line 314) * ode: ode. (line 9) * offset <1>: Options. (line 166) * offset: Pens. (line 115) @@ -9127,7 +9204,7 @@ Index * OR: Arithmetic & logical. (line 80) * orientation: Frames and pictures. (line 95) -* orthographic: three. (line 329) +* orthographic: three. (line 333) * outformat: three. (line 122) * outprefix: Frames and pictures. (line 83) * output <1>: Options. (line 141) @@ -9148,6 +9225,7 @@ Index * parallelogram: flowchart. (line 50) * parametric surface: graph3. (line 100) * parametrized curve: graph. (line 636) +* partialsum: math. (line 53) * patch-dependent colors: three. (line 76) * path <1>: flowchart. (line 81) * path <2>: three. (line 43) @@ -9163,42 +9241,42 @@ Index * pdfviewerOptions: Options. (line 128) * pen: Pens. (line 6) * PenMargin: draw. (line 42) -* PenMargin2: three. (line 537) -* PenMargin3: three. (line 537) +* PenMargin2: three. (line 556) +* PenMargin3: three. (line 556) * PenMargins: draw. (line 42) -* PenMargins2: three. (line 537) -* PenMargins3: three. (line 537) +* PenMargins2: three. (line 556) +* PenMargins3: three. (line 556) * perpendicular: geometry. (line 6) -* perspective: three. (line 349) +* perspective: three. (line 353) * picture: Frames and pictures. (line 35) -* picture alignment: Frames and pictures. (line 205) +* picture alignment: Frames and pictures. (line 209) * piecewisestraight: Paths and guides. (line 81) * Pl: Mathematical functions. (line 48) * plain: plain. (line 6) * planar: three. (line 84) -* plane: three. (line 292) -* planeproject: three. (line 461) -* point <1>: three. (line 478) +* plane: three. (line 296) +* planeproject: three. (line 480) +* point <1>: three. (line 497) * point: Paths and guides. (line 84) * polar: Data types. (line 119) * polargraph: graph. (line 90) * polygon: graph. (line 484) * pop: Arrays. (line 39) * Portrait: Frames and pictures. (line 95) -* postcontrol <1>: three. (line 478) -* postcontrol: Paths and guides. (line 129) +* postcontrol <1>: three. (line 497) +* postcontrol: Paths and guides. (line 135) * postfix operators: Self & prefix operators. (line 19) -* postscript: Frames and pictures. (line 267) +* postscript: Frames and pictures. (line 271) * PostScript fonts: Pens. (line 210) * PostScript subpath: Tutorial. (line 132) * pow10: Mathematical functions. (line 6) * prc: three. (line 226) * precision: Files. (line 88) -* precontrol <1>: three. (line 478) -* precontrol: Paths and guides. (line 122) +* precontrol <1>: three. (line 497) +* precontrol: Paths and guides. (line 128) * prefix operators: Self & prefix operators. (line 6) * private: Structures. (line 6) @@ -9212,7 +9290,7 @@ Index * public: Structures. (line 6) * push: Arrays. (line 39) * Python usage: Interactive mode. (line 80) -* quadraticroots: Arrays. (line 308) +* quadraticroots: Arrays. (line 312) * quarticroots: math. (line 22) * quit <1>: Debugger. (line 54) * quit <2>: Interactive mode. (line 59) @@ -9222,18 +9300,19 @@ Index (line 6) * RadialShade: Frames and pictures. (line 159) * radialshade: fill. (line 49) +* RadialShadeDraw: Frames and pictures. (line 163) * radians: Mathematical functions. (line 17) -* radius <1>: three. (line 478) -* radius: Paths and guides. (line 118) +* radius <1>: three. (line 497) +* radius: Paths and guides. (line 124) * Rainbow: palette. (line 12) * rand: Mathematical functions. (line 39) * randMax: Mathematical functions. (line 39) -* read: Arrays. (line 384) +* read: Arrays. (line 388) * reading: Files. (line 11) -* reading string arrays: Arrays. (line 353) +* reading string arrays: Arrays. (line 357) * readline: Files. (line 130) * real: Data types. (line 33) * realDigits: Data types. (line 33) @@ -9245,8 +9324,8 @@ Index * recursion: Functions. (line 88) * reflect: Transforms. (line 51) * Relative: label. (line 52) -* relpoint: Paths and guides. (line 156) -* reltime: Paths and guides. (line 152) +* relpoint: Paths and guides. (line 162) +* reltime: Paths and guides. (line 158) * remainder: Mathematical functions. (line 6) * rename: Files. (line 147) @@ -9255,12 +9334,12 @@ Index * replace: Data types. (line 252) * resetdefaultpen: Pens. (line 353) * rest arguments: Rest arguments. (line 6) -* restore: Frames and pictures. (line 261) +* restore: Frames and pictures. (line 265) * restricted: Structures. (line 6) * return: Debugger. (line 48) -* reverse <1>: three. (line 478) +* reverse <1>: three. (line 497) * reverse <2>: Arrays. (line 146) -* reverse <3>: Paths and guides. (line 163) +* reverse <3>: Paths and guides. (line 169) * reverse: Data types. (line 248) * rewind: Files. (line 88) * rfind: Data types. (line 229) @@ -9270,8 +9349,8 @@ Index * Right: graph. (line 287) * RightSide: label. (line 62) * RightTicks: graph. (line 161) -* RightView: three. (line 372) -* rotate: three. (line 429) +* RightView: three. (line 376) +* rotate: three. (line 448) * Rotate: label. (line 37) * Rotate(pair z): label. (line 40) * round: Mathematical functions. @@ -9286,15 +9365,15 @@ Index * Russian: unicode. (line 7) * S: Tutorial. (line 104) * safe: Options. (line 161) -* save: Frames and pictures. (line 258) +* save: Frames and pictures. (line 262) * saveline: Files. (line 130) -* scale: three. (line 428) +* scale: three. (line 447) * Scale: graph. (line 698) * scale <1>: graph. (line 682) * scale <2>: Transforms. (line 39) * scale: Pens. (line 115) * Scale: label. (line 46) -* scale3: three. (line 425) +* scale3: three. (line 444) * scaled graph: graph. (line 663) * scientific graph: graph. (line 396) * scroll: Files. (line 104) @@ -9307,6 +9386,7 @@ Index * seconds: Data types. (line 300) * seek: Files. (line 88) * seekeof: Files. (line 88) +* segment: math. (line 50) * segmentation fault: Help. (line 33) * self operators: Self & prefix operators. (line 6) @@ -9316,12 +9396,12 @@ Index * sgn: Mathematical functions. (line 26) * shading: fill. (line 32) -* shift <1>: three. (line 413) +* shift <1>: three. (line 432) * shift: Transforms. (line 27) * Shift: label. (line 34) * shiftless: Transforms. (line 53) * shipout: Frames and pictures. (line 83) -* showtarget: three. (line 329) +* showtarget: three. (line 333) * Si: Mathematical functions. (line 48) * signedint: Files. (line 70) @@ -9338,21 +9418,25 @@ Index * singlereal: Files. (line 70) * sinh: Mathematical functions. (line 6) +* SixViews: three. (line 391) +* SixViewsFR: three. (line 391) +* SixViewsUS: three. (line 391) * size <1>: Options. (line 141) -* size <2>: three. (line 478) +* size <2>: three. (line 497) * size <3>: Frames and pictures. (line 43) * size: Paths and guides. (line 70) * size3: three. (line 254) * slant: Transforms. (line 45) * Slant: label. (line 43) * sleep: Data types. (line 334) -* slice: Paths and guides. (line 231) +* slice: Paths and guides. (line 237) * slices: Slices. (line 6) * slide: slide. (line 6) +* slope: math. (line 44) * slopefield: slopefield. (line 6) * solid: Pens. (line 95) * solids: solids. (line 9) -* solve: Arrays. (line 262) +* solve: Arrays. (line 281) * sort: Arrays. (line 187) * Spline <1>: graph3. (line 100) * Spline: graph. (line 34) @@ -9371,18 +9455,18 @@ Index * step: Debugger. (line 39) * stickframe: markers. (line 16) * stop: Debugger. (line 10) -* straight: three. (line 478) +* straight: three. (line 497) * Straight: graph. (line 31) * straight: Paths and guides. (line 77) * strftime: Data types. (line 292) * string: Data types. (line 179) * stroke: fill. (line 36) -* strokepath: Paths and guides. (line 288) +* strokepath: Paths and guides. (line 294) * strptime: Data types. (line 300) * struct: Structures. (line 6) * structures: Structures. (line 6) -* subpath <1>: three. (line 478) -* subpath: Paths and guides. (line 166) +* subpath <1>: three. (line 497) +* subpath: Paths and guides. (line 172) * subpictures: Frames and pictures. (line 103) * substr: Data types. (line 244) * Subversion: Subversion. (line 6) @@ -9405,24 +9489,24 @@ Index (line 6) * tanh: Mathematical functions. (line 6) -* target: three. (line 329) +* target: three. (line 333) * tell: Files. (line 88) * tension <1>: three. (line 6) * tension: Bezier curves. (line 56) -* tensionSpecifier: Paths and guides. (line 379) +* tensionSpecifier: Paths and guides. (line 385) * tensor product shading: fill. (line 74) * tensorshade: fill. (line 74) * tex <1>: Options. (line 141) -* tex: Frames and pictures. (line 274) +* tex: Frames and pictures. (line 278) * TeX fonts: Pens. (line 201) * TeX string: Data types. (line 179) * texcommand: Configuring. (line 67) * TeXHead: draw. (line 26) -* TeXHead3: three. (line 521) +* TeXHead3: three. (line 540) * texpath <1>: label. (line 116) * texpath: Configuring. (line 67) -* texpreamble: Frames and pictures. (line 282) -* texreset: Frames and pictures. (line 285) +* texpreamble: Frames and pictures. (line 286) +* texreset: Frames and pictures. (line 289) * textbook graph: graph. (line 371) * tgz: UNIX binary distributions. (line 6) @@ -9430,39 +9514,43 @@ Index * thin: three. (line 105) * this: Structures. (line 6) * three: three. (line 6) +* ThreeViews: three. (line 391) +* ThreeViewsFR: three. (line 391) +* ThreeViewsUS: three. (line 391) * tick: graph. (line 342) * Ticks: graph. (line 161) * ticks: graph. (line 161) * tildeframe: markers. (line 26) * tile: Pens. (line 251) * tilings: Pens. (line 238) +* time <1>: math. (line 30) * time: Data types. (line 292) -* times: Paths and guides. (line 200) +* times: Paths and guides. (line 206) * Top: graph. (line 137) -* TopView: three. (line 372) +* TopView: three. (line 376) * trace: Debugger. (line 51) * trailingzero: graph. (line 175) -* transform <1>: three. (line 453) +* transform <1>: three. (line 472) * transform: Transforms. (line 6) -* transform3: three. (line 408) +* transform3: three. (line 427) * transparency: Pens. (line 222) * transpose: Arrays. (line 208) * tree: tree. (line 9) * trembling: trembling. (line 6) * triangle: geometry. (line 6) * triangulate: contour. (line 157) -* tridiagonal: Arrays. (line 265) +* tridiagonal: Arrays. (line 269) * trigonometric integrals: Mathematical functions. (line 48) * triple: Data types. (line 108) * TrueMargin: draw. (line 42) -* TrueMargin3: three. (line 537) +* TrueMargin3: three. (line 556) * tube <1>: tube. (line 6) * tube: three. (line 105) * tutorial: Tutorial. (line 6) * typedef <1>: Functions. (line 36) * typedef: Data types. (line 344) -* undefined: Paths and guides. (line 262) +* undefined: Paths and guides. (line 268) * UnFill: Frames and pictures. (line 152) * unfill: fill. (line 106) * UnFill: draw. (line 26) @@ -9470,9 +9558,9 @@ Index * uniform: Arrays. (line 155) * Uninstall: Uninstall. (line 6) * unit: Data types. (line 78) -* unitbox <1>: three. (line 298) +* unitbox <1>: three. (line 302) * unitbox: Tutorial. (line 153) -* unitcircle <1>: three. (line 265) +* unitcircle <1>: three. (line 269) * unitcircle: Tutorial. (line 126) * unitrand: Mathematical functions. (line 39) @@ -9482,20 +9570,21 @@ Index (line 6) * unpacking: Rest arguments. (line 39) * unravel: Import. (line 31) -* up: three. (line 329) +* up: three. (line 333) * update: Files. (line 35) * UpsideDown: Frames and pictures. (line 95) -* usepackage: Frames and pictures. (line 287) +* usepackage: Frames and pictures. (line 291) * user coordinates: Tutorial. (line 84) * user-defined operators: User-defined operators. (line 6) * usleep: Data types. (line 337) +* value: math. (line 38) * variable initializers: Variable initializers. (line 6) * vectorfield: graph. (line 975) * vectorfield3: graph3. (line 159) -* vectorization: Arrays. (line 322) -* verbatim: Frames and pictures. (line 267) +* vectorization: Arrays. (line 326) +* verbatim: Frames and pictures. (line 271) * vertex-dependent colors: three. (line 76) * Vertical: flowchart. (line 81) * viewportheight: LaTeX usage. (line 32) @@ -9507,17 +9596,17 @@ Index * virtual functions: Structures. (line 189) * void: Data types. (line 10) * W: Tutorial. (line 104) -* whatever: Paths and guides. (line 226) +* whatever: Paths and guides. (line 232) * Wheel: palette. (line 22) * wheel mouse: GUI. (line 6) * while: Programming. (line 29) -* white-space string delimiter mode: Arrays. (line 353) +* white-space string delimiter mode: Arrays. (line 357) * width: LaTeX usage. (line 32) -* windingnumber: Paths and guides. (line 262) -* word: Arrays. (line 353) -* write <1>: Arrays. (line 393) +* windingnumber: Paths and guides. (line 268) +* word: Arrays. (line 357) +* write <1>: Arrays. (line 397) * write: Files. (line 50) -* X: three. (line 265) +* X: three. (line 269) * xasy: GUI. (line 6) * xaxis3: graph3. (line 7) * xelatex <1>: Options. (line 141) @@ -9531,15 +9620,15 @@ Index * xoutput: Files. (line 70) * xpart: Data types. (line 89) * xscale: Transforms. (line 33) -* xscale3: three. (line 416) +* xscale3: three. (line 435) * xtick: graph. (line 342) -* XY: three. (line 438) +* XY: three. (line 457) * XYEquals: graph3. (line 20) * XYZero: graph3. (line 20) * XZEquals: graph3. (line 20) * XZero: graph. (line 275) * XZZero: graph3. (line 20) -* Y <1>: three. (line 265) +* Y <1>: three. (line 269) * Y: Mathematical functions. (line 6) * yaxis3: graph3. (line 7) @@ -9548,14 +9637,14 @@ Index * ylimits: graph. (line 636) * ypart: Data types. (line 92) * yscale: Transforms. (line 36) -* yscale3: three. (line 419) +* yscale3: three. (line 438) * ytick: graph. (line 342) -* YX: three. (line 453) -* YZ: three. (line 453) +* YX: three. (line 472) +* YZ: three. (line 472) * YZEquals: graph3. (line 20) * YZero: graph. (line 125) * YZZero: graph3. (line 20) -* Z: three. (line 265) +* Z: three. (line 269) * zaxis3: graph3. (line 7) * zero_Ai: Mathematical functions. (line 48) @@ -9571,9 +9660,9 @@ Index * zeta: Mathematical functions. (line 48) * zpart: Data types. (line 161) -* zscale3: three. (line 422) -* ZX: three. (line 453) -* ZY: three. (line 453) +* zscale3: three. (line 441) +* ZX: three. (line 472) +* ZY: three. (line 472) * |: Arithmetic & logical. (line 62) * ||: Arithmetic & logical. @@ -9610,118 +9699,118 @@ Node: Bezier curves52867 Node: Programming56444 Ref: array iteration57258 Node: Data types58340 -Ref: format67330 -Node: Paths and guides70933 -Ref: circle71187 -Ref: arctime76544 -Ref: extension80399 -Node: Pens87082 -Ref: fillrule94448 -Ref: basealign95345 -Ref: transparency98170 -Ref: makepen101613 -Ref: overwrite102451 -Node: Transforms103661 -Node: Frames and pictures105452 -Ref: envelope106593 -Ref: size107676 -Ref: unitsize108663 -Ref: shipout109723 -Ref: filltype112056 -Ref: add115025 -Ref: add about115971 -Ref: tex118909 -Node: Files119783 -Ref: cd120748 -Ref: scroll125180 -Node: Variable initializers128253 -Node: Structures130548 -Node: Operators138000 -Node: Arithmetic & logical138314 -Node: Self & prefix operators140288 -Node: User-defined operators141076 -Node: Implicit scaling141987 -Node: Functions142550 -Ref: stack overflow145303 -Node: Default arguments145867 -Node: Named arguments146606 -Node: Rest arguments148768 -Node: Mathematical functions151578 -Node: Arrays156185 -Ref: sort163230 -Ref: tridiagonal165521 -Ref: solve166749 -Node: Slices170942 -Node: Casts174835 -Node: Import176801 -Node: Static182031 -Node: LaTeX usage184927 -Node: Base modules190365 -Node: plain192865 -Node: simplex193517 -Node: math193790 -Node: interpolate194889 -Node: geometry195168 -Node: trembling195762 -Node: stats196113 -Node: patterns196373 -Node: markers196609 -Node: tree198392 -Node: binarytree198580 -Node: drawtree199169 -Node: syzygy199373 -Node: feynman199647 -Node: roundedpath199922 -Node: animation200205 -Ref: animate200622 -Node: embed201761 -Node: slide203550 -Node: MetaPost203890 -Node: unicode204606 -Node: latin1205494 -Node: babel205862 -Node: labelpath206091 -Node: labelpath3206911 -Node: annotate207222 -Node: CAD207693 -Node: graph208003 -Ref: ticks215132 -Ref: pathmarkers228411 -Ref: marker228876 -Ref: markuniform229227 -Ref: errorbars231018 -Ref: automatic scaling235074 -Node: palette245720 -Ref: images245838 -Ref: image250009 -Ref: logimage250487 -Ref: penimage251293 -Node: three251737 -Ref: PostScript3D275270 -Node: obj276962 -Node: graph3277214 -Ref: GaussianSurface282339 -Node: grid3283424 -Node: solids284164 -Node: tube285112 -Node: flowchart287347 -Node: contour291916 -Node: contour3297041 -Node: slopefield297348 -Node: ode298785 -Node: Options299045 -Ref: configuration file304841 -Ref: settings304841 -Ref: convert306042 -Node: Interactive mode309009 -Ref: history311162 -Node: GUI312467 -Node: GUI installation312970 -Node: GUI usage314112 -Node: PostScript to Asymptote315015 -Node: Help315771 -Node: Debugger317507 -Node: Credits319292 -Node: Index320205 +Ref: format67348 +Node: Paths and guides70951 +Ref: circle71205 +Ref: arctime76693 +Ref: extension80548 +Node: Pens87231 +Ref: fillrule94597 +Ref: basealign95494 +Ref: transparency98319 +Ref: makepen101762 +Ref: overwrite102600 +Node: Transforms103810 +Node: Frames and pictures105601 +Ref: envelope106742 +Ref: size107825 +Ref: unitsize108812 +Ref: shipout109872 +Ref: filltype112205 +Ref: add115342 +Ref: add about116288 +Ref: tex119226 +Node: Files120100 +Ref: cd121065 +Ref: scroll125497 +Node: Variable initializers128570 +Node: Structures130865 +Node: Operators138317 +Node: Arithmetic & logical138631 +Node: Self & prefix operators140605 +Node: User-defined operators141393 +Node: Implicit scaling142304 +Node: Functions142867 +Ref: stack overflow145620 +Node: Default arguments146184 +Node: Named arguments146923 +Node: Rest arguments149085 +Node: Mathematical functions151895 +Node: Arrays156502 +Ref: sort163513 +Ref: tridiagonal165923 +Ref: solve167151 +Node: Slices171344 +Node: Casts175237 +Node: Import177203 +Node: Static182433 +Node: LaTeX usage185329 +Node: Base modules190767 +Node: plain193267 +Node: simplex193919 +Node: math194192 +Node: interpolate196525 +Node: geometry196804 +Node: trembling197398 +Node: stats197749 +Node: patterns198009 +Node: markers198245 +Node: tree200028 +Node: binarytree200216 +Node: drawtree200805 +Node: syzygy201009 +Node: feynman201283 +Node: roundedpath201558 +Node: animation201841 +Ref: animate202258 +Node: embed203397 +Node: slide205186 +Node: MetaPost205526 +Node: unicode206242 +Node: latin1207130 +Node: babel207498 +Node: labelpath207727 +Node: labelpath3208547 +Node: annotate208858 +Node: CAD209329 +Node: graph209639 +Ref: ticks216768 +Ref: pathmarkers230047 +Ref: marker230512 +Ref: markuniform230863 +Ref: errorbars232654 +Ref: automatic scaling236710 +Node: palette247356 +Ref: images247474 +Ref: image251645 +Ref: logimage252123 +Ref: penimage252929 +Node: three253373 +Ref: PostScript3D277702 +Node: obj279394 +Node: graph3279646 +Ref: GaussianSurface284771 +Node: grid3285856 +Node: solids286596 +Node: tube287544 +Node: flowchart289779 +Node: contour294348 +Node: contour3299473 +Node: slopefield299780 +Node: ode301217 +Node: Options301477 +Ref: configuration file307273 +Ref: settings307273 +Ref: convert308474 +Node: Interactive mode311441 +Ref: history313594 +Node: GUI314899 +Node: GUI installation315402 +Node: GUI usage316544 +Node: PostScript to Asymptote317447 +Node: Help318203 +Node: Debugger319939 +Node: Credits321724 +Node: Index322637 End Tag Table diff --git a/Build/source/utils/asymptote/drawelement.h b/Build/source/utils/asymptote/drawelement.h index 44e739b74e9..0687cd6cd66 100644 --- a/Build/source/utils/asymptote/drawelement.h +++ b/Build/source/utils/asymptote/drawelement.h @@ -20,8 +20,9 @@ #include "glrender.h" namespace run { -extern double *copyArrayC(const vm::array *a, size_t dim, - GCPlacement placement); +template<class T> +extern void copyArrayC(T* &dest, const vm::array *a, size_t dim, + GCPlacement placement); } namespace camp { diff --git a/Build/source/utils/asymptote/drawpath3.h b/Build/source/utils/asymptote/drawpath3.h index 1285e7656da..d267a93b734 100644 --- a/Build/source/utils/asymptote/drawpath3.h +++ b/Build/source/utils/asymptote/drawpath3.h @@ -107,7 +107,7 @@ public: degree=nknots-n-1; - knots=run::copyArrayC(knot,0,NoGC); + run::copyArrayC(knots,knot,0,NoGC); #ifdef HAVE_GL Controls=NULL; diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h index 8e9fa28827a..d90402e7105 100644 --- a/Build/source/utils/asymptote/drawsurface.h +++ b/Build/source/utils/asymptote/drawsurface.h @@ -238,8 +238,8 @@ public: udegree=nuknots-nu-1; vdegree=nvknots-nv-1; - uknots=run::copyArrayC(uknot,0,NoGC); - vknots=run::copyArrayC(vknot,0,NoGC); + run::copyArrayC(uknots,uknot,0,NoGC); + run::copyArrayC(vknots,vknot,0,NoGC); pen surfacepen=vm::read<camp::pen>(p,0); invisible=surfacepen.invisible(); diff --git a/Build/source/utils/asymptote/examples/filesurface.asy b/Build/source/utils/asymptote/examples/filesurface.asy index 702b503fc28..98adc045f07 100644 --- a/Build/source/utils/asymptote/examples/filesurface.asy +++ b/Build/source/utils/asymptote/examples/filesurface.asy @@ -26,9 +26,20 @@ draw(s,meshpen=thick()); triple m=currentpicture.userMin; triple M=currentpicture.userMax; triple target=0.5*(m+M); -currentprojection=perspective(camera=target+realmult(dir(68,225),M-m), - target=target); xaxis3("$x$",Bounds,InTicks); yaxis3("$y$",Bounds,InTicks(Step=1,step=0.1)); zaxis3("$z$",Bounds,InTicks); + +/* +picture palette; +size3(palette,1cm); +draw(palette,unitcube,red); +frame F=palette.fit3(); +add(F,(M.x,m.y,m.z)); +*/ + +currentprojection=perspective(camera=target+realmult(dir(68,225),M-m), + target=target); + + diff --git a/Build/source/utils/asymptote/examples/orthocenter.asy b/Build/source/utils/asymptote/examples/orthocenter.asy index 3a4b314f68f..73dfde51954 100644 --- a/Build/source/utils/asymptote/examples/orthocenter.asy +++ b/Build/source/utils/asymptote/examples/orthocenter.asy @@ -29,8 +29,8 @@ draw(O--Bp); draw("4",C--O); draw(O--Cp); -dot("$O$",O,1.5*dir(B--Bp,Cp--C),red); -dot("$A$",A,1.5*dir(C--A,B--A),red); +dot("$O$",O,dir(B--Bp,Cp--C),red); +dot("$A$",A,dir(C--A,B--A),red); dot("$B$",B,NW,red); dot("$C$",C,dir(A--C,B--C),red); dot("$A'$",Ap,dir(A--Ap),red); diff --git a/Build/source/utils/asymptote/examples/slidedemo.asy b/Build/source/utils/asymptote/examples/slidedemo.asy index ae2f48c33a2..52ede757b47 100644 --- a/Build/source/utils/asymptote/examples/slidedemo.asy +++ b/Build/source/utils/asymptote/examples/slidedemo.asy @@ -112,6 +112,6 @@ add(pic.fit(0,14cm)); title("\mbox{Asymptote: 2D \& 3D Vector Graphics Language}"); asyinclude("logo3"); center("\tt http://asymptote.sf.net"); -center("(freely available under the GNU public license)"); +center("(freely available under the LGPL license)"); bibliography("refs"); diff --git a/Build/source/utils/asymptote/fftw++.h b/Build/source/utils/asymptote/fftw++.h index a622516b5a6..658768551be 100644 --- a/Build/source/utils/asymptote/fftw++.h +++ b/Build/source/utils/asymptote/fftw++.h @@ -58,6 +58,10 @@ static array1<Complex> NULL1; static array2<Complex> NULL2; static array3<Complex> NULL3; +static array1<double> NULL1D; +static array2<double> NULL2D; +static array3<double> NULL3D; + #else #ifdef HAVE_POSIX_MEMALIGN @@ -163,10 +167,9 @@ inline int GetWisdom(std::ifstream& s) {return s.get();} // class fftw { protected: - unsigned int size; + unsigned int doubles; // number of double words in dataset int sign; double norm; - bool shift; fftw_plan plan; bool inplace; @@ -175,20 +178,24 @@ protected: return dist ? dist : ((stride == 1) ? n : 1); } - unsigned int realsize(unsigned int n, Complex *in, Complex *out) { - return n/2+(!out || in == out); + unsigned int realsize(unsigned int n, Complex *in, Complex *out=NULL) { + return (!out || in == out) ? 2*(n/2+1) : n; } unsigned int realsize(unsigned int n, Complex *in, double *out) { return realsize(n,in,(Complex *) out); } + unsigned int realsize(unsigned int n, double *in, Complex *out) { + return realsize(n,(Complex *) in,out); + } + static std::ifstream ifWisdom; static std::ofstream ofWisdom; static bool Wise; public: - // Shift the Fourier origin to (nx/2,0) for even nx. + // Shift the Fourier origin to (nx/2,0). static void Shift(Complex *data, unsigned int nx, unsigned int ny, int sign=0) { const unsigned int nyp=ny/2+1; @@ -196,20 +203,17 @@ public: if(nx % 2 == 0) { int pinc=2*nyp; for(Complex *p=data+nyp; p < pstop; p += pinc) { - //#pragma ivdep for(unsigned int j=0; j < nyp; j++) p[j]=-p[j]; } } else { if(sign) { unsigned int c=nx/2; - int pinc=nyp; - double arg=2.0*M_PI*c/nx; - Complex zeta(cos(arg),sign*sin(arg)); - Complex zetak=zeta; - for(Complex *p=data+nyp; p < pstop; p += pinc) { - //#pragma ivdep - for(unsigned int j=0; j < nyp; j++) p[j] *= zetak; - zetak *= zeta; + double arg=2.0*M_PI*c/nx; + for(unsigned int i=0; i < nx; i++) { + double iarg=i*arg; + Complex zeta(cos(iarg),sign*sin(iarg)); + Complex *datai=data+i*nyp; + for(unsigned int j=0; j < nyp; j++) datai[j] *= zeta; } } else { std::cerr << "Shift for odd nx must be signed and interleaved" @@ -226,14 +230,13 @@ public: const unsigned int nyzp=ny*nzp; if(nx % 2 == 0 && ny % 2 == 0) { const unsigned int pinc=2*nzp; - Complex *p,*pstop; - p=pstop=data; + Complex *pstop=data; + Complex *p=data; for(unsigned i=0; i < nx; i++) { if(i % 2) p -= nzp; else p += nzp; pstop += nyzp; for(; p < pstop; p += pinc) { - //#pragma ivdep for(unsigned int k=0; k < nzp; k++) p[k]=-p[k]; } } @@ -243,19 +246,17 @@ public: unsigned int cy=ny/2; double twopi=2.0*M_PI; double argx=twopi*cx/nx; - Complex zetax(cos(argx),sign*sin(argx)); double argy=twopi*cy/ny; - Complex zetay(cos(argy),sign*sin(argy)); - Complex zetak(1.0,0.0); for(unsigned i=0; i < nx; i++) { + double iarg=i*argx; + Complex zetax(cos(iarg),sign*sin(iarg)); Complex *datai=data+nyzp*i; for(unsigned j=0; j < ny; j++) { - //#pragma ivdep + double jarg=j*argy; + Complex zeta=zetax*Complex(cos(jarg),sign*sin(jarg)); Complex *dataij=datai+nzp*j; - for(unsigned int k=0; k < nzp; k++) dataij[k] *= zetak; - zetak *= zetay; + for(unsigned int k=0; k < nzp; k++) dataij[k] *= zeta; } - zetak *= zetax; } } else { std::cerr << "Shift for odd nx or ny must be signed and interleaved" @@ -268,8 +269,9 @@ public: static unsigned int effort; static const char *WisdomName; - fftw(unsigned int size, int sign, unsigned int n=0) : - size(size), sign(sign), norm(1.0/(n ? n : size)), shift(false), plan(NULL) + fftw(unsigned int doubles, int sign, unsigned int n=0) : + doubles(doubles), sign(sign), norm(1.0/(n ? n : (doubles+1)/2)), + plan(NULL) {} virtual ~fftw() {if(plan) fftw_destroy_plan(plan);} @@ -285,7 +287,7 @@ public: void Setup(Complex *in, Complex *out=NULL) { if(!Wise) LoadWisdom(); bool alloc=!in; - if(alloc) in=ComplexAlign(size); + if(alloc) in=ComplexAlign((doubles+1)/2); #ifndef NO_CHECK_ALIGN CheckAlign(in,"constructor input"); if(out) CheckAlign(out,"constructor output"); @@ -300,12 +302,12 @@ public: exit(1); } - if(alloc) deleteAlign(in,size); + if(alloc) deleteAlign(in,(doubles+1)/2); SaveWisdom(); } void Setup(Complex *in, double *out) {Setup(in,(Complex *) out);} - void Setup(double *in, Complex *out) {Setup((Complex *) in,out);} + void Setup(double *in, Complex *out=NULL) {Setup((Complex *) in,out);} void LoadWisdom() { ifWisdom.open(WisdomName); @@ -320,7 +322,7 @@ public: ofWisdom.close(); } - virtual void Execute(Complex *in, Complex *out) { + virtual void Execute(Complex *in, Complex *out, bool=false) { fftw_execute_dft(plan,(fftw_complex *) in,(fftw_complex *) out); } @@ -343,7 +345,7 @@ public: Execute(in,out); } - void fft(double *in, Complex *out) { + void fft(double *in, Complex *out=NULL) { fft((Complex *) in,out); } @@ -353,12 +355,10 @@ public: void fft0(Complex *in, Complex *out=NULL) { Setout(in,out); - shift=true; - Execute(in,out); - shift=false; + Execute(in,out,true); } - void fft0(double *in, Complex *out) { + void fft0(double *in, Complex *out=NULL) { fft0((Complex *) in,out); } @@ -367,7 +367,12 @@ public: } void Normalize(Complex *out) { - for(unsigned int i=0; i < size; i++) out[i] *= norm; + unsigned int stop=(doubles+1)/2; + for(unsigned int i=0; i < stop; i++) out[i] *= norm; + } + + void Normalize(double *out) { + for(unsigned int i=0; i < doubles; i++) out[i] *= norm; } virtual void fftNormalized(Complex *in, Complex *out=NULL) { @@ -386,9 +391,7 @@ public: void fft0Normalized(Complex *in, Complex *out=NULL) { Setout(in,out); - shift=true; - Execute(in,out); - shift=false; + Execute(in,out,true); Normalize(out); } @@ -427,11 +430,11 @@ public: // fft1d Forward(n,-1,in,out); // Forward.fft(in,out); // -// fft1d Backward(n,1,out,in); -// Backward.fft(out,in); +// fft1d Backward(n,1,in,out); +// Backward.fft(in,out); // -// fft1d Backward(n,1,out,in); -// Backward.fftNormalized(out,in); // True inverse of Forward.fft(in,out); +// fft1d Backward(n,1,in,out); +// Backward.fftNormalized(in,out); // True inverse of Forward.fft(out,in); // // In-place usage: // @@ -445,11 +448,11 @@ class fft1d : public fftw { unsigned int nx; public: fft1d(unsigned int nx, int sign, Complex *in=NULL, Complex *out=NULL) - : fftw(nx,sign), nx(nx) {Setup(in,out);} + : fftw(2*nx,sign), nx(nx) {Setup(in,out);} #ifdef __Array_h__ fft1d(int sign, const array1<Complex>& in, const array1<Complex>& out=NULL1) - : fftw(in.Nx(),sign), nx(in.Nx()) {Setup(in,out);} + : fftw(2*in.Nx(),sign), nx(in.Nx()) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { @@ -486,7 +489,7 @@ class mfft1d : public fftw { public: mfft1d(unsigned int nx, int sign, unsigned int m=1, unsigned int stride=1, unsigned int dist=0, Complex *in=NULL, Complex *out=NULL) - : fftw((nx-1)*stride+(m-1)*Dist(nx,stride,dist)+1,sign,nx), + : fftw(2*((nx-1)*stride+(m-1)*Dist(nx,stride,dist)+1),sign,nx), nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} @@ -526,24 +529,25 @@ class rcfft1d : public fftw { unsigned int nx; public: rcfft1d(unsigned int nx, Complex *out=NULL) - : fftw(nx/2+1,-1,nx), nx(nx) {Setup(out);} + : fftw(2*(nx/2+1),-1,nx), nx(nx) {Setup(out);} rcfft1d(unsigned int nx, double *in, Complex *out=NULL) - : fftw(nx/2+1,-1,nx), nx(nx) {Setup(in,out);} + : fftw(realsize(nx,in,out),-1,nx), nx(nx) {Setup(in,out);} #ifdef __Array_h__ - rcfft1d(const array1<Complex>& in) - : fftw(in.Size(),-1,2*(in.Nx()-1)), nx(2*(in.Nx()-1)) {Setup(in);} + rcfft1d(unsigned int nx, const array1<Complex>& out) + : fftw(out.Size(),-1,nx), nx(nx) {Setup(out);} - rcfft1d(const array1<double>& in, const array1<Complex>& out) - : fftw(out.Size(),-1,in.Size()), nx(in.Nx()) {Setup(in,out);} + rcfft1d(unsigned int nx, const array1<double>& in, + const array1<Complex>& out=NULL1) + : fftw(realsize(nx,in(),out()),-1,nx), nx(nx) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { return fftw_plan_dft_r2c_1d(nx,(double *) in,(fftw_complex *) out, effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool=false) { fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out); } }; @@ -572,25 +576,26 @@ public: class crfft1d : public fftw { unsigned int nx; public: - crfft1d(unsigned int nx, Complex *in=NULL) - : fftw(nx/2+1,1,nx), nx(nx) {Setup(in);} + crfft1d(unsigned int nx, double *out=NULL) + : fftw(2*(nx/2+1),1,nx), nx(nx) {Setup(out);} - crfft1d(unsigned int nx, Complex *in, double *out) + crfft1d(unsigned int nx, Complex *in, double *out=NULL) : fftw(realsize(nx,in,out),1,nx), nx(nx) {Setup(in,out);} #ifdef __Array_h__ - crfft1d(const array1<Complex>& in) - : fftw(in.Size(),1,2*(in.Nx()-1)), nx(2*(in.Nx()-1)) {Setup(in);} + crfft1d(unsigned int nx, const array1<double>& out) + : fftw(out.Size(),1,nx), nx(nx) {Setup(out);} - crfft1d(const array1<Complex>& in, const array1<double>& out) - : fftw(out.Size()/2,1,out.Size()), nx(out.Nx()) {Setup(in,out);} + crfft1d(unsigned int nx, const array1<Complex>& in, + const array1<double>& out=NULL1D) + : fftw(2*in.Size(),1,nx), nx(nx) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { return fftw_plan_dft_c2r_1d(nx,(fftw_complex *) in,(double *) out,effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool=false) { fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out); } }; @@ -625,12 +630,12 @@ class mrcfft1d : public fftw { public: mrcfft1d(unsigned int nx, unsigned int m=1, unsigned int stride=1, unsigned int dist=0, Complex *out=NULL) - : fftw(nx/2*stride+(m-1)*Dist(nx,stride,dist)+1,-1,nx), nx(nx), m(m), + : fftw(2*(nx/2*stride+(m-1)*Dist(nx,stride,dist)+1),-1,nx), nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(out);} mrcfft1d(unsigned int nx, unsigned int m=1, unsigned int stride=1, unsigned int dist=0, double *in=NULL, Complex *out=NULL) - : fftw(nx/2*stride+(m-1)*Dist(nx,stride,dist)+1,-1,nx), nx(nx), m(m), + : fftw(2*(nx/2*stride+(m-1)*Dist(nx,stride,dist)+1),-1,nx), nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} fftw_plan Plan(Complex *in, Complex *out) { @@ -641,7 +646,7 @@ public: effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool=false) { fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out); } @@ -681,7 +686,7 @@ class mcrfft1d : public fftw { public: mcrfft1d(unsigned int nx, unsigned int m=1, unsigned int stride=1, unsigned int dist=0, Complex *in=NULL, double *out=NULL) - : fftw((realsize(nx,in,out)-1)*stride+(m-1)*Dist(nx,stride,dist)+1,1,nx), + : fftw((realsize(nx,in,out)-2)*stride+2*(m-1)*Dist(nx,stride,dist)+2,1,nx), nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} fftw_plan Plan(Complex *in, Complex *out) { @@ -692,7 +697,7 @@ public: effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool=false) { fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out); } @@ -710,11 +715,11 @@ public: // fft2d Forward(nx,ny,-1,in,out); // Forward.fft(in,out); // -// fft2d Backward(nx,ny,1,out,in); -// Backward.fft(out,in); +// fft2d Backward(nx,ny,1,in,out); +// Backward.fft(in,out); // -// fft2d Backward(nx,ny,1,out,in); -// Backward.fftNormalized(out,in); // True inverse of Forward.fft(in,out); +// fft2d Backward(nx,ny,1,in,out); +// Backward.fftNormalized(in,out); // True inverse of Forward.fft(out,in); // // In-place usage: // @@ -733,17 +738,21 @@ class fft2d : public fftw { public: fft2d(unsigned int nx, unsigned int ny, int sign, Complex *in=NULL, Complex *out=NULL) - : fftw(nx*ny,sign), nx(nx), ny(ny) {Setup(in,out);} + : fftw(2*nx*ny,sign), nx(nx), ny(ny) {Setup(in,out);} #ifdef __Array_h__ fft2d(int sign, const array2<Complex>& in, const array2<Complex>& out=NULL2) - : fftw(in.Size(),sign), nx(in.Nx()), ny(in.Ny()) {Setup(in,out);} + : fftw(2*in.Size(),sign), nx(in.Nx()), ny(in.Ny()) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { return fftw_plan_dft_2d(nx,ny,(fftw_complex *) in,(fftw_complex *) out, sign,effort); } + + void Execute(Complex *in, Complex *out, bool=false) { + fftw_execute_dft(plan,(fftw_complex *) in,(fftw_complex *) out); + } }; // Compute the complex two-dimensional Fourier transform of nx times ny real @@ -756,8 +765,6 @@ public: // // rcfft2d Forward(nx,ny,in,out); // Forward.fft(in,out); // Origin of Fourier domain at (0,0) -// Forward.fft0(in,out); // Origin of Fourier domain at (nx/2,0) -// // // In-place usage: // @@ -773,28 +780,29 @@ class rcfft2d : public fftw { unsigned int nx; unsigned int ny; public: - rcfft2d(unsigned int nx, unsigned int ny, Complex *out=NULL) : - fftw(nx*(ny/2+1),-1,nx*ny), nx(nx), ny(ny) {Setup(out);} + rcfft2d(unsigned int nx, unsigned int ny, Complex *out=NULL) + : fftw(2*nx*(ny/2+1),-1,nx*ny), nx(nx), ny(ny) {Setup(out);} - rcfft2d(unsigned int nx, unsigned int ny, double *in, Complex *out=NULL) : - fftw(nx*(ny/2+1),-1,nx*ny), nx(nx), ny(ny) {Setup(in,out);} + rcfft2d(unsigned int nx, unsigned int ny, double *in, Complex *out=NULL) + : fftw(nx*realsize(ny,in,out),-1,nx*ny), nx(nx), ny(ny) {Setup(in,out);} #ifdef __Array_h__ - rcfft2d(const array2<Complex>& in) : - fftw(in.Size(),-1,in.Nx()*2*(in.Ny()-1)), nx(in.Nx()), ny(2*(in.Ny()-1)) - {Setup(in);} + rcfft2d(unsigned int ny, const array2<Complex>& out) + : fftw(out.Size(),-1,out.Nx()*ny), nx(out.Nx()), ny(ny) {Setup(out);} - rcfft2d(const array2<double>& in, const array2<Complex>& out) : - fftw(out.Size(),-1,in.Size()), nx(in.Nx()), ny(in.Ny()) {Setup(in,out);} -#endif + rcfft2d(unsigned int ny, const array2<double>& in, + const array2<Complex>& out=NULL2) + : fftw(in.Nx()*realsize(ny,in(),out()),-1,in.Nx()*ny), nx(in.Nx()), ny(ny) + {Setup(in,out);} +#endif fftw_plan Plan(Complex *in, Complex *out) { return fftw_plan_dft_r2c_2d(nx,ny,(double *) in,(fftw_complex *) out, effort); } - void Execute(Complex *in, Complex *out) { - if(shift) Shift(in,nx,ny); + void Execute(Complex *in, Complex *out, bool shift=false) { + if(shift && inplace) Shift(in,nx,ny); fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out); } }; @@ -813,7 +821,6 @@ public: // Backward.fft(in,out); // Origin of Fourier domain at (0,0) // Backward.fft0(in,out); // Origin of Fourier domain at (nx/2,0) // -// // In-place usage: // // crfft2d Backward(nx,ny); @@ -828,20 +835,19 @@ class crfft2d : public fftw { unsigned int nx; unsigned int ny; public: - crfft2d(unsigned int nx, unsigned int ny, Complex *in=NULL) - : fftw(nx*(ny/2+1),1,nx*ny), nx(nx), ny(ny) {Setup(in);} + crfft2d(unsigned int nx, unsigned int ny, Complex *in=NULL) : + fftw(2*nx*(ny/2+1),1,nx*ny), nx(nx), ny(ny) {Setup(in);} - crfft2d(unsigned int nx, unsigned int ny, Complex *in, double *out) - : fftw(nx*(realsize(ny,in,out)),1,nx*ny), nx(nx), ny(ny) {Setup(in,out);} + crfft2d(unsigned int nx, unsigned int ny, Complex *in, double *out) : + fftw(nx*realsize(ny,in,out),1,nx*ny), nx(nx), ny(ny) {Setup(in,out);} #ifdef __Array_h__ - crfft2d(const array2<Complex>& in) : - fftw(in.Size(),1,in.Nx()*2*(in.Ny()-1)), nx(in.Nx()), ny(2*(in.Ny()-1)) - {Setup(in);} + crfft2d(unsigned int ny, const array2<double>& out) + : fftw(out.Size(),1,out.Nx()*ny), nx(out.Nx()), ny(ny) {Setup(out);} - crfft2d(const array2<Complex>& in, const array2<double>& out) : - fftw(out.Size()/2,1,out.Size()), nx(out.Nx()), ny(out.Ny()) - {Setup(in,out);} + crfft2d(unsigned int ny, const array2<Complex>& in, + const array2<double>& out=NULL2D) + : fftw(2*in.Size(),1,in.Nx()*ny), nx(in.Nx()), ny(ny) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { @@ -849,7 +855,7 @@ public: effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool shift=false) { fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out); if(shift) Shift(out,nx,ny); } @@ -864,11 +870,11 @@ public: // fft3d Forward(nx,ny,nz,-1,in,out); // Forward.fft(in,out); // -// fft3d Backward(nx,ny,nz,1,out,in); -// Backward.fft(out,in); +// fft3d Backward(nx,ny,nz,1,in,out); +// Backward.fft(in,out); // -// fft3d Backward(nx,ny,nz,1,out,in); -// Backward.fftNormalized(out,in); // True inverse of Forward.fft(in,out); +// fft3d Backward(nx,ny,nz,1,in,out); +// Backward.fftNormalized(in,out); // True inverse of Forward.fft(out,in); // // In-place usage: // @@ -889,11 +895,11 @@ class fft3d : public fftw { public: fft3d(unsigned int nx, unsigned int ny, unsigned int nz, int sign, Complex *in=NULL, Complex *out=NULL) - : fftw(nx*ny*nz,sign), nx(nx), ny(ny), nz(nz) {Setup(in,out);} + : fftw(2*nx*ny*nz,sign), nx(nx), ny(ny), nz(nz) {Setup(in,out);} #ifdef __Array_h__ fft3d(int sign, const array3<Complex>& in, const array3<Complex>& out=NULL3) - : fftw(in.Size(),sign), nx(in.Nx()), ny(in.Ny()), nz(in.Nz()) + : fftw(2*in.Size(),sign), nx(in.Nx()), ny(in.Ny()), nz(in.Nz()) {Setup(in,out);} #endif @@ -913,8 +919,6 @@ public: // // rcfft3d Forward(nx,ny,nz,in,out); // Forward.fft(in,out); // Origin of Fourier domain at (0,0) -// Forward.fft0(in,out); // Origin of Fourier domain at (nx/2,ny/2,0) -// // // In-place usage: // @@ -932,20 +936,21 @@ class rcfft3d : public fftw { unsigned int nz; public: rcfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *out=NULL) - : fftw(nx*ny*(nz/2+1),-1,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(out);} + : fftw(2*nx*ny*(nz/2+1),-1,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(out);} rcfft3d(unsigned int nx, unsigned int ny, unsigned int nz, double *in, - Complex *out=NULL) : fftw(nx*ny*(nz/2+1),-1,nx*ny*nz), + Complex *out=NULL) : fftw(nx*ny*realsize(nz,in,out),-1,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(in,out);} #ifdef __Array_h__ - rcfft3d(const array3<Complex>& in) : - fftw(in.Size(),-1,in.Nx()*in.Ny()*2*(in.Nz()-1)), - nx(in.Nx()), ny(in.Ny()), nz(2*(in.Nz()-1)) {Setup(in);} - - rcfft3d(const array3<double>& in, const array3<Complex>& out) : - fftw(out.Size(),-1,in.Size()), - nx(in.Nx()), ny(in.Ny()), nz(in.Nz()) {Setup(in,out);} + rcfft3d(unsigned int nz, const array3<Complex>& out) + : fftw(out.Size(),-1,out.Nx()*out.Ny()*nz), + nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);} + + rcfft3d(unsigned int nz, const array3<double>& in, + const array3<Complex>& out=NULL3) + : fftw(in.Nx()*in.Ny()*realsize(nz,in(),out()),-1,in.Size()), + nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { @@ -953,8 +958,8 @@ public: effort); } - void Execute(Complex *in, Complex *out) { - if(shift) Shift(in,nx,ny,nz); + void Execute(Complex *in, Complex *out, bool shift=false) { + if(shift && inplace) Shift(in,nx,ny,nz); fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out); } }; @@ -989,19 +994,22 @@ class crfft3d : public fftw { unsigned int nz; public: crfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *in=NULL) - : fftw(nx*ny*(nz/2+1),1,nx*ny*nz), nx(nx), ny(ny), nz(nz) + : fftw(2*nx*ny*(nz/2+1),1,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(in);} + crfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *in, - double *out) : fftw(nx*ny*(realsize(nz,in,out)),1,nx*ny*nz), - nx(nx), ny(ny), nz(nz) {Setup(in,out);} + double *out=NULL) : + fftw(nx*ny*(realsize(nz,in,out)),1,nx*ny*nz), nx(nx), ny(ny), nz(nz) + {Setup(in,out);} #ifdef __Array_h__ - crfft3d(const array3<Complex>& in) : - fftw(in.Size(),1,in.Nx()*in.Ny()*2*(in.Nz()-1)), - nx(in.Nx()), ny(in.Ny()), nz(2*(in.Nz()-1)) {Setup(in);} - - crfft3d(const array3<Complex>& in, const array3<double>& out) : - fftw(out.Size()/2,1,out.Size()), - nx(out.Nx()), ny(out.Ny()), nz(out.Nz()) {Setup(in,out);} + crfft3d(unsigned int nz, const array3<double>& out) : + fftw(out.Size(),1,out.Nx()*out.Ny()*nz), + nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);} + + crfft3d(unsigned int nz, const array3<Complex>& in, + const array3<double>& out=NULL3D) : + fftw(2*in.Size(),1,in.Nx()*in.Ny()*nz), + nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in,out);} #endif fftw_plan Plan(Complex *in, Complex *out) { @@ -1009,7 +1017,7 @@ public: effort); } - void Execute(Complex *in, Complex *out) { + void Execute(Complex *in, Complex *out, bool shift=false) { fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out); if(shift) Shift(out,nx,ny,nz); } diff --git a/Build/source/utils/asymptote/flatguide.cc b/Build/source/utils/asymptote/flatguide.cc index bfc26dfd041..1bbf375593d 100644 --- a/Build/source/utils/asymptote/flatguide.cc +++ b/Build/source/utils/asymptote/flatguide.cc @@ -28,6 +28,10 @@ void flatguide::uncheckedAdd(path p, bool allowsolve) { Int n=p.length(); if(n < 0) return; + if(n == 0) { + addPoint(p,0); + return; + } int nminus1=n-1; if(!allowsolve && p.cyclic()) addPre(p,0); for(Int i=0; i < nminus1;) { diff --git a/Build/source/utils/asymptote/pair.h b/Build/source/utils/asymptote/pair.h index 7d2716fb991..dc8f86d03b5 100644 --- a/Build/source/utils/asymptote/pair.h +++ b/Build/source/utils/asymptote/pair.h @@ -37,23 +37,23 @@ public: friend pair operator+ (const pair& z, const pair& w) { - return pair(z.x + w.x, z.y + w.y); + return pair(z.x+w.x,z.y+w.y); } friend pair operator- (const pair& z, const pair& w) { - return pair(z.x - w.x, z.y - w.y); + return pair(z.x-w.x,z.y-w.y); } friend pair operator- (const pair& z) { - return pair(-z.x, -z.y); + return pair(-z.x,-z.y); } // Complex multiplication friend pair operator* (const pair& z, const pair& w) { - return pair(z.x*w.x - z.y*w.y, z.x*w.y + w.x*z.y); + return pair(z.x*w.x-z.y*w.y,z.x*w.y+w.x*z.y); } const pair& operator+= (const pair& w) @@ -156,7 +156,7 @@ public: friend double dot(const pair& z, const pair& w) { - return z.getx()*w.getx()+z.gety()*w.gety(); + return z.x*w.x+z.y*w.y; } // Return the principal branch of the square root (non-negative real part). diff --git a/Build/source/utils/asymptote/patches/cygwin_xdr.patch b/Build/source/utils/asymptote/patches/cygwin_xdr.patch index 4dae5b6eb27..b0ece108abf 100644 --- a/Build/source/utils/asymptote/patches/cygwin_xdr.patch +++ b/Build/source/utils/asymptote/patches/cygwin_xdr.patch @@ -1,6 +1,6 @@ -diff -ru rpc.broken/auth.h rpc/auth.h ---- rpc.broken/auth.h 2005-03-10 14:32:52.000000000 -0700 -+++ rpc/auth.h 2005-08-02 02:09:08.000000000 -0600 +diff -rub rpc.broken/auth.h rpc/auth.h +--- rpc.broken/auth.h 2005-03-10 14:32:50.001000000 -0700 ++++ rpc/auth.h 2010-05-04 18:46:19.890625000 -0700 @@ -62,7 +62,7 @@ AUTH_FAILED=7 /* some unknown reason */ }; @@ -10,41 +10,27 @@ diff -ru rpc.broken/auth.h rpc/auth.h typedef u_long u_int32; /* 32-bit unsigned integers */ #endif -diff -ru rpc.broken/xdr.h rpc/xdr.h ---- rpc.broken/xdr.h 2005-03-10 14:32:54.000000000 -0700 -+++ rpc/xdr.h 2005-08-02 01:56:46.000000000 -0600 +diff -rub rpc.broken/svc.h rpc/svc.h +--- rpc.broken/svc.h 2005-03-10 14:32:51.001000000 -0700 ++++ rpc/svc.h 2010-05-04 18:46:47.343750000 -0700 +@@ -37,6 +37,8 @@ + #ifndef __SVC_HEADER__ + #define __SVC_HEADER__ + ++#include <netinet/in.h> ++ + /* + * This interface must manage two items concerning remote procedure calling: + * +diff -rub rpc.broken/xdr.h rpc/xdr.h +--- rpc.broken/xdr.h 2005-03-10 14:32:52.001000000 -0700 ++++ rpc/xdr.h 2010-05-04 18:46:19.906250000 -0700 @@ -1,4 +1,3 @@ -/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape -@@ -6,28 +5,27 @@ - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. -- * -+ * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. -- * -+ * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. -- * -+ * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. -- * -+ * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. -- * -+ * - * Sun Microsystems, Inc. +@@ -27,7 +26,6 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ @@ -72,21 +58,6 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h /* * XDR provides a conventional way for converting between C data -@@ -47,10 +54,10 @@ - * - * Each data type provides a single procedure which takes two arguments: - * -- * bool_t -- * xdrproc(xdrs, argresp) -- * XDR *xdrs; -- * <type> *argresp; -+ * bool_t -+ * xdrproc(xdrs, argresp) -+ * XDR *xdrs; -+ * <type> *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be @@ -74,17 +81,66 @@ * request. */ @@ -157,12 +128,9 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h /* * A xdrproc_t exists for each data type which is to be encoded or decoded. -@@ -93,43 +149,31 @@ - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should +@@ -95,41 +151,29 @@ * allocate dynamic storage of the appropriate size and return it. -- * bool_t (*xdrproc_t)(XDR *, caddr_t *); -+ * bool_t (*xdrproc_t)(XDR *, caddr_t *); + * bool_t (*xdrproc_t)(XDR *, caddr_t *); */ -typedef bool_t (*xdrproc_t)(); +typedef bool_t (*xdrproc_t) (XDR *, void *,...); @@ -194,19 +162,13 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h /* * Operations defined on a XDR handle * -- * XDR *xdrs; -- * long *longp; -- * caddr_t addr; -- * u_int len; -- * u_int pos; -- */ -+ * XDR *xdrs; + * XDR *xdrs; + * int32_t *int32p; -+ * long *longp; -+ * caddr_t addr; -+ * u_int len; -+ * u_int pos; -+ */ + * long *longp; + * caddr_t addr; + * u_int len; + * u_int pos; + */ +#define XDR_GETINT32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) +#define xdr_getint32(xdrs, int32p) \ @@ -220,40 +182,33 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h #define XDR_GETLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define xdr_getlong(xdrs, longp) \ -@@ -165,12 +209,16 @@ - #define xdr_inline(xdrs, len) \ +@@ -166,11 +210,15 @@ (*(xdrs)->x_ops->x_inline)(xdrs, len) --#define XDR_DESTROY(xdrs) \ -- if ((xdrs)->x_ops->x_destroy) \ -- (*(xdrs)->x_ops->x_destroy)(xdrs) --#define xdr_destroy(xdrs) \ -- if ((xdrs)->x_ops->x_destroy) \ -- (*(xdrs)->x_ops->x_destroy)(xdrs) -+#define XDR_DESTROY(xdrs) \ + #define XDR_DESTROY(xdrs) \ + do { \ -+ if ((xdrs)->x_ops->x_destroy) \ + if ((xdrs)->x_ops->x_destroy) \ +- (*(xdrs)->x_ops->x_destroy)(xdrs) + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) -+#define xdr_destroy(xdrs) \ + #define xdr_destroy(xdrs) \ + do { \ -+ if ((xdrs)->x_ops->x_destroy) \ + if ((xdrs)->x_ops->x_destroy) \ +- (*(xdrs)->x_ops->x_destroy)(xdrs) + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) /* * Support struct for discriminated unions. -@@ -183,93 +231,143 @@ +@@ -183,13 +231,14 @@ * If there is no match and no default routine it is an error. */ #define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim { -- int value; -- xdrproc_t proc; +struct xdr_discrim +{ -+ int value; -+ xdrproc_t proc; + int value; + xdrproc_t proc; }; /* @@ -262,33 +217,13 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h * Caveat emptor: these use single memory cycles to get the * data from the underlying buffer, and will fail to operate * properly if the data is not aligned. The standard way to use these - * is to say: -- * if ((buf = XDR_INLINE(xdrs, count)) == NULL) -- * return (FALSE); -- * <<< macro calls >>> -+ * if ((buf = XDR_INLINE(xdrs, count)) == NULL) -+ * return (FALSE); -+ * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * +@@ -203,73 +252,122 @@ * N.B. and frozen for all time: each data type here uses 4 bytes * of external representation. */ -#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v)) - --#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) --#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) --#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) --#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) --#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) -- --#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) --#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) --#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) --#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) --#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) ++ +#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) +#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v))) +#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) @@ -303,12 +238,18 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h +#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) + -+ -+#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -+#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -+#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -+#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) -+ + + #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) + #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) +-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) + #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) + #define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) + +-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) +-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) +-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) +-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) +-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) +#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) @@ -389,15 +330,12 @@ diff -ru rpc.broken/xdr.h rpc/xdr.h * Common opaque bytes objects used by many rpc protocols; * declared here due to commonality. */ --#define MAX_NETOBJ_SZ 1024 + #define MAX_NETOBJ_SZ 1024 -struct netobj { -- u_int n_len; -- char *n_bytes; -+#define MAX_NETOBJ_SZ 1024 +struct netobj +{ -+ u_int n_len; -+ char *n_bytes; + u_int n_len; + char *n_bytes; }; typedef struct netobj netobj; -extern bool_t xdr_netobj(); diff --git a/Build/source/utils/asymptote/runarray.cc b/Build/source/utils/asymptote/runarray.cc index b7c06461911..257464d3bb9 100644 --- a/Build/source/utils/asymptote/runarray.cc +++ b/Build/source/utils/asymptote/runarray.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } @@ -63,7 +104,7 @@ function *realRealFunction(); #define CURRENTPEN processData().currentpen -#line 20 "runarray.in" +#line 21 "runarray.in" #include "array.h" #include "arrayop.h" #include "triple.h" @@ -78,12 +119,17 @@ function *realRealFunction(); using namespace camp; using namespace vm; +namespace run { +extern pair zero; +} + typedef array boolarray; typedef array Intarray; typedef array Intarray2; typedef array realarray; typedef array realarray2; typedef array pairarray; +typedef array pairarray2; typedef array triplearray2; using types::booleanArray; @@ -92,6 +138,7 @@ using types::IntArray2; using types::realArray; using types::realArray2; using types::pairArray; +using types::pairArray2; using types::tripleArray2; typedef callable callableReal; @@ -163,36 +210,6 @@ array *copyArray(array *a) return c; } -inline size_t checkdimension(const array *a, size_t dim) -{ - size_t size=checkArray(a); - if(dim && size != dim) { - ostringstream buf; - buf << "array of length " << dim << " expected"; - error(buf); - } - return size; -} - -double *copyArrayC(const array *a, size_t dim, GCPlacement placement) -{ - size_t size=checkdimension(a,dim); - double *c=(placement == NoGC) ? new double [size] : - new(placement) double[size]; - for(size_t i=0; i < size; i++) - c[i]=read<double>(a,i); - return c; -} - -triple *copyTripleArrayC(const array *a, size_t dim) -{ - size_t size=checkdimension(a,dim); - triple *c=new triple[size]; - for(size_t i=0; i < size; i++) - c[i]=read<triple>(a,i); - return c; -} - array *copyArray2(array *a) { size_t size=checkArray(a); @@ -229,55 +246,6 @@ array *copyArray3(array *a) return c; } -double *copyArray2C(const array *a, bool square, size_t dim2, - GCPlacement placement) -{ - size_t n=checkArray(a); - size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); - if(n > 0 && dim2 && m != dim2) { - ostringstream buf; - buf << "second matrix dimension must be " << dim2; - error(buf); - } - - double *c=(placement == NoGC) ? new double [n*m] : new(placement) double[n*m]; - for(size_t i=0; i < n; i++) { - array *ai=read<array*>(a,i); - size_t aisize=checkArray(ai); - if(aisize == m) { - double *ci=c+i*m; - for(size_t j=0; j < m; j++) - ci[j]=read<double>(ai,j); - } else - error(square ? "matrix must be square" : "matrix must be rectangular"); - } - return c; -} - -triple *copyTripleArray2C(const array *a, bool square, size_t dim2) -{ - size_t n=checkArray(a); - size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); - if(n > 0 && dim2 && m != dim2) { - ostringstream buf; - buf << "second matrix dimension must be " << dim2; - error(buf); - } - - triple *c=new triple[n*m]; - for(size_t i=0; i < n; i++) { - array *ai=read<array*>(a,i); - size_t aisize=checkArray(ai); - if(aisize == m) { - triple *ci=c+i*m; - for(size_t j=0; j < m; j++) - ci[j]=read<triple>(ai,j); - } else - error(square ? "matrix must be square" : "matrix must be rectangular"); - } - return c; -} - double *copyTripleArray2Components(array *a, bool square, size_t dim2, GCPlacement placement) { @@ -370,6 +338,43 @@ triple multshiftless(const array& t, const triple& v) (read<real>(t2,0)*x+read<real>(t2,1)*y+read<real>(t2,2)*z)*f); } +template<class T> +array *mult(array *a, array *b) +{ + size_t n=checkArray(a); + + size_t nb=checkArray(b); + size_t na0=n == 0 ? 0 : checkArray(read<array*>(a,0)); + if(na0 != nb) + error(incommensurate); + + size_t nb0=nb == 0 ? 0 : checkArray(read<array*>(b,0)); + + array *c=new array(n); + + T *A,*B; + copyArray2C(A,a,false); + copyArray2C(B,b,false); + + for(size_t i=0; i < n; ++i) { + T *Ai=A+i*nb; + array *ci=new array(nb0); + (*c)[i]=ci; + for(size_t j=0; j < nb0; ++j) { + T sum=0.0; + size_t kj=j; + for(size_t k=0; k < nb; ++k, kj += nb0) + sum += Ai[k]*B[kj]; + (*ci)[j]=sum; + } + } + + delete[] B; + delete[] A; + + return c; +} + double norm(double *a, size_t n) { if(n == 0) return 0.0; @@ -525,10 +530,10 @@ void integeroverflow(size_t i) namespace run { // Create an empty array. -#line 479 "runarray.in" +#line 444 "runarray.in" void emptyArray(stack *Stack) { -#line 480 "runarray.in" +#line 445 "runarray.in" {Stack->push<array*>(new array(0)); return;} } @@ -537,11 +542,11 @@ void emptyArray(stack *Stack) // is popped off the stack, followed by each dimension in reverse order. // The array itself is technically a one dimensional array of one // dimension arrays and so on. -#line 489 "runarray.in" +#line 454 "runarray.in" void newDeepArray(stack *Stack) { Int depth=vm::pop<Int>(Stack); -#line 490 "runarray.in" +#line 455 "runarray.in" assert(depth > 0); Int *dims = new Int[depth]; @@ -560,11 +565,11 @@ void newDeepArray(stack *Stack) // Creates an array with elements already specified. First, the number // of elements is popped off the stack, followed by each element in // reverse order. -#line 509 "runarray.in" +#line 474 "runarray.in" void newInitializedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 510 "runarray.in" +#line 475 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -577,12 +582,12 @@ void newInitializedArray(stack *Stack) // Similar to newInitializedArray, but after the n elements, append another // array to it. -#line 523 "runarray.in" +#line 488 "runarray.in" void newAppendedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); array* tail=vm::pop<array*>(Stack); -#line 524 "runarray.in" +#line 489 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -597,13 +602,13 @@ void newAppendedArray(stack *Stack) // The function T[] array(int n, T value, int depth=0) produces a array of n // copies of x, where each copy is copied up to depth. -#line 539 "runarray.in" +#line 504 "runarray.in" void newDuplicateArray(stack *Stack) { Int depth=vm::pop<Int>(Stack,Int_MAX); item value=vm::pop(Stack); Int n=vm::pop<Int>(Stack); -#line 540 "runarray.in" +#line 505 "runarray.in" if(n < 0) error("cannot create a negative length array"); if(depth < 0) error("cannot copy to a negative depth"); @@ -611,12 +616,12 @@ void newDuplicateArray(stack *Stack) } // Read an element from an array. Checks for initialization & bounds. -#line 548 "runarray.in" +#line 513 "runarray.in" void arrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 549 "runarray.in" +#line 514 "runarray.in" item& i=arrayRead(a,n); if (i.empty()) { ostringstream buf; @@ -627,50 +632,50 @@ void arrayRead(stack *Stack) } // Slice a substring from an array. -#line 560 "runarray.in" +#line 525 "runarray.in" void arraySliceRead(stack *Stack) { Int right=vm::pop<Int>(Stack); Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 561 "runarray.in" +#line 526 "runarray.in" checkArray(a); {Stack->push(a->slice(left, right)); return;} } // Slice a substring from an array. This implements the cases a[i:] and a[:] // where the endpoint is not given, and assumed to be the length of the array. -#line 568 "runarray.in" +#line 533 "runarray.in" void arraySliceReadToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 569 "runarray.in" +#line 534 "runarray.in" size_t len=checkArray(a); {Stack->push(a->slice(left, (Int)len)); return;} } // Read an element from an array of arrays. Check bounds and initialize // as necessary. -#line 576 "runarray.in" +#line 541 "runarray.in" void arrayArrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 577 "runarray.in" +#line 542 "runarray.in" item& i=arrayRead(a,n); if (i.empty()) i=new array(0); {Stack->push(i); return;} } // Write an element to an array. Increase size if necessary. -#line 584 "runarray.in" +#line 549 "runarray.in" void arrayWrite(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); item value=vm::pop(Stack); -#line 585 "runarray.in" +#line 550 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -684,27 +689,27 @@ void arrayWrite(stack *Stack) {Stack->push(value); return;} } -#line 599 "runarray.in" +#line 564 "runarray.in" void arraySliceWrite(stack *Stack) { Int right=vm::pop<Int>(Stack); Int left=vm::pop<Int>(Stack); array * dest=vm::pop<array *>(Stack); array * src=vm::pop<array *>(Stack); -#line 600 "runarray.in" +#line 565 "runarray.in" checkArray(src); checkArray(dest); dest->setSlice(left, right, src); {Stack->push<array*>(src); return;} } -#line 607 "runarray.in" +#line 572 "runarray.in" void arraySliceWriteToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * dest=vm::pop<array *>(Stack); array * src=vm::pop<array *>(Stack); -#line 608 "runarray.in" +#line 573 "runarray.in" checkArray(src); size_t len=checkArray(dest); dest->setSlice(left, (Int) len, src); @@ -712,20 +717,20 @@ void arraySliceWriteToEnd(stack *Stack) } // Returns the length of an array. -#line 616 "runarray.in" +#line 581 "runarray.in" void arrayLength(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 617 "runarray.in" +#line 582 "runarray.in" {Stack->push<Int>((Int) checkArray(a)); return;} } // Returns an array of integers representing the keys of the array. -#line 622 "runarray.in" +#line 587 "runarray.in" void arrayKeys(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 623 "runarray.in" +#line 588 "runarray.in" size_t size=checkArray(a); array *keys=new array(); @@ -739,33 +744,33 @@ void arrayKeys(stack *Stack) } // Return the cyclic flag for an array. -#line 637 "runarray.in" +#line 602 "runarray.in" void arrayCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 638 "runarray.in" +#line 603 "runarray.in" checkArray(a); {Stack->push<bool>(a->cyclic()); return;} } -#line 643 "runarray.in" +#line 608 "runarray.in" void arraySetCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 644 "runarray.in" +#line 609 "runarray.in" checkArray(a); a->cyclic(b); {Stack->push<bool>(b); return;} } // Check to see if an array element is initialized. -#line 651 "runarray.in" +#line 616 "runarray.in" void arrayInitializedHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); Int n=vm::pop<Int>(Stack); -#line 652 "runarray.in" +#line 617 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -775,62 +780,62 @@ void arrayInitializedHelper(stack *Stack) } // Returns the initialize method for an array. -#line 662 "runarray.in" +#line 627 "runarray.in" void arrayInitialized(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 663 "runarray.in" +#line 628 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInitializedHelper),a)); return;} } // The helper function for the cyclic method that sets the cyclic flag. -#line 668 "runarray.in" +#line 633 "runarray.in" void arrayCyclicHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 669 "runarray.in" +#line 634 "runarray.in" checkArray(a); a->cyclic(b); } // Set the cyclic flag for an array. -#line 675 "runarray.in" +#line 640 "runarray.in" void arrayCyclic(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 676 "runarray.in" +#line 641 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayCyclicHelper),a)); return;} } // The helper function for the push method that does the actual operation. -#line 681 "runarray.in" +#line 646 "runarray.in" void arrayPushHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); item x=vm::pop(Stack); -#line 682 "runarray.in" +#line 647 "runarray.in" checkArray(a); a->push(x); {Stack->push(x); return;} } // Returns the push method for an array. -#line 689 "runarray.in" +#line 654 "runarray.in" void arrayPush(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 690 "runarray.in" +#line 655 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPushHelper),a)); return;} } // The helper function for the append method that appends b to a. -#line 695 "runarray.in" +#line 660 "runarray.in" void arrayAppendHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); -#line 696 "runarray.in" +#line 661 "runarray.in" checkArray(a); size_t size=checkArray(b); for(size_t i=0; i < size; i++) @@ -838,20 +843,20 @@ void arrayAppendHelper(stack *Stack) } // Returns the append method for an array. -#line 704 "runarray.in" +#line 669 "runarray.in" void arrayAppend(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 705 "runarray.in" +#line 670 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;} } // The helper function for the pop method. -#line 710 "runarray.in" +#line 675 "runarray.in" void arrayPopHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 711 "runarray.in" +#line 676 "runarray.in" size_t asize=checkArray(a); if(asize == 0) error("cannot pop element from empty array"); @@ -859,22 +864,22 @@ void arrayPopHelper(stack *Stack) } // Returns the pop method for an array. -#line 719 "runarray.in" +#line 684 "runarray.in" void arrayPop(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 720 "runarray.in" +#line 685 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;} } // The helper function for the insert method. -#line 725 "runarray.in" +#line 690 "runarray.in" void arrayInsertHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * x=vm::pop<array *>(Stack); Int i=vm::pop<Int>(Stack); -#line 726 "runarray.in" +#line 691 "runarray.in" size_t asize=checkArray(a); checkArray(x); if(a->cyclic() && asize > 0) i=imod(i,asize); @@ -884,39 +889,39 @@ void arrayInsertHelper(stack *Stack) } // Returns the insert method for an array. -#line 736 "runarray.in" +#line 701 "runarray.in" void arrayInsert(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 737 "runarray.in" +#line 702 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;} } // Returns the delete method for an array. -#line 742 "runarray.in" +#line 707 "runarray.in" void arrayDelete(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 743 "runarray.in" +#line 708 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;} } -#line 747 "runarray.in" +#line 712 "runarray.in" void arrayAlias(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 748 "runarray.in" +#line 713 "runarray.in" {Stack->push<bool>(a==b); return;} } // Return array formed by indexing array a with elements of integer array b -#line 753 "runarray.in" +#line 718 "runarray.in" void arrayIntArray(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 754 "runarray.in" +#line 719 "runarray.in" size_t asize=checkArray(a); size_t bsize=checkArray(b); array *r=new array(bsize); @@ -934,13 +939,13 @@ void arrayIntArray(stack *Stack) // returns the complement of the integer array a in {0,2,...,n-1}, // so that b[complement(a,b.length)] yields the complement of b[a]. -#line 772 "runarray.in" +#line 737 "runarray.in" // Intarray* complement(Intarray *a, Int n); void gen_runarray31(stack *Stack) { Int n=vm::pop<Int>(Stack); Intarray * a=vm::pop<Intarray *>(Stack); -#line 773 "runarray.in" +#line 738 "runarray.in" size_t asize=checkArray(a); array *r=new array(0); bool *keep=new bool[n]; @@ -957,12 +962,12 @@ void gen_runarray31(stack *Stack) } // Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n -#line 790 "runarray.in" +#line 755 "runarray.in" void arraySequence(stack *Stack) { Int n=vm::pop<Int>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 791 "runarray.in" +#line 756 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -974,12 +979,12 @@ void arraySequence(stack *Stack) } // Return the array {0,1,...n-1} -#line 803 "runarray.in" +#line 768 "runarray.in" // Intarray* sequence(Int n); void gen_runarray33(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 804 "runarray.in" +#line 769 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -989,12 +994,12 @@ void gen_runarray33(stack *Stack) } // Apply a function to each element of an array -#line 814 "runarray.in" +#line 779 "runarray.in" void arrayFunction(stack *Stack) { array * a=vm::pop<array *>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 815 "runarray.in" +#line 780 "runarray.in" size_t size=checkArray(a); array *b=new array(size); for(size_t i=0; i < size; ++i) { @@ -1005,12 +1010,12 @@ void arrayFunction(stack *Stack) {Stack->push<array*>(b); return;} } -#line 826 "runarray.in" +#line 791 "runarray.in" void arraySort(stack *Stack) { callable * f=vm::pop<callable *>(Stack); array * a=vm::pop<array *>(Stack); -#line 827 "runarray.in" +#line 792 "runarray.in" array *c=copyArray(a); compareFunc=f; FuncStack=Stack; @@ -1018,12 +1023,12 @@ void arraySort(stack *Stack) {Stack->push<array*>(c); return;} } -#line 835 "runarray.in" +#line 800 "runarray.in" // bool all(boolarray *a); void gen_runarray36(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 836 "runarray.in" +#line 801 "runarray.in" size_t size=checkArray(a); bool c=true; for(size_t i=0; i < size; i++) @@ -1031,12 +1036,12 @@ void gen_runarray36(stack *Stack) {Stack->push<bool>(c); return;} } -#line 844 "runarray.in" +#line 809 "runarray.in" // boolarray* !(boolarray* a); void gen_runarray37(stack *Stack) { boolarray* a=vm::pop<boolarray*>(Stack); -#line 845 "runarray.in" +#line 810 "runarray.in" size_t size=checkArray(a); array *c=new array(size); for(size_t i=0; i < size; i++) @@ -1044,12 +1049,12 @@ void gen_runarray37(stack *Stack) {Stack->push<boolarray*>(c); return;} } -#line 853 "runarray.in" +#line 818 "runarray.in" // Int sum(boolarray *a); void gen_runarray38(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 854 "runarray.in" +#line 819 "runarray.in" size_t size=checkArray(a); Int sum=0; for(size_t i=0; i < size; i++) @@ -1057,19 +1062,19 @@ void gen_runarray38(stack *Stack) {Stack->push<Int>(sum); return;} } -#line 862 "runarray.in" +#line 827 "runarray.in" void arrayCopy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 863 "runarray.in" +#line 828 "runarray.in" {Stack->push<array*>(copyArray(a)); return;} } -#line 867 "runarray.in" +#line 832 "runarray.in" void arrayConcat(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 868 "runarray.in" +#line 833 "runarray.in" // a is an array of arrays to be concatenated together. // The signature is // T[] concat(... T[][] a); @@ -1096,27 +1101,27 @@ void arrayConcat(stack *Stack) {Stack->push<array*>(result); return;} } -#line 895 "runarray.in" +#line 860 "runarray.in" void array2Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 896 "runarray.in" +#line 861 "runarray.in" {Stack->push<array*>(copyArray2(a)); return;} } -#line 900 "runarray.in" +#line 865 "runarray.in" void array3Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 901 "runarray.in" +#line 866 "runarray.in" {Stack->push<array*>(copyArray3(a)); return;} } -#line 905 "runarray.in" +#line 870 "runarray.in" void array2Transpose(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 906 "runarray.in" +#line 871 "runarray.in" size_t asize=checkArray(a); array *c=new array(0); for(size_t i=0; i < asize; i++) { @@ -1143,12 +1148,12 @@ void array2Transpose(stack *Stack) // permutation (021 or 120, etc; original is 012). // Transpose by sending respective members to the permutated locations: // return the array obtained by putting a[i][j][k] into position perm{ijk}. -#line 933 "runarray.in" +#line 898 "runarray.in" void array3Transpose(stack *Stack) { array * perm=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 934 "runarray.in" +#line 899 "runarray.in" const size_t DIM=3; if(checkArray(perm) != DIM) { @@ -1232,13 +1237,13 @@ void array3Transpose(stack *Stack) // In a boolean array, find the index of the nth true value or -1 if not found // If n is negative, search backwards. -#line 1018 "runarray.in" +#line 983 "runarray.in" // Int find(boolarray *a, Int n=1); void gen_runarray45(stack *Stack) { Int n=vm::pop<Int>(Stack,1); boolarray * a=vm::pop<boolarray *>(Stack); -#line 1019 "runarray.in" +#line 984 "runarray.in" size_t size=checkArray(a); Int j=-1; if(n > 0) @@ -1256,13 +1261,13 @@ void gen_runarray45(stack *Stack) // construct vector obtained by replacing those elements of b for which the // corresponding elements of a are false by the corresponding element of c. -#line 1037 "runarray.in" +#line 1002 "runarray.in" void arrayConditional(stack *Stack) { array * c=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 1038 "runarray.in" +#line 1003 "runarray.in" size_t size=checkArray(a); array *r=new array(size); if(b && c) { @@ -1286,42 +1291,22 @@ void arrayConditional(stack *Stack) } // Return an n x n identity matrix. -#line 1062 "runarray.in" +#line 1027 "runarray.in" // realarray2* identity(Int n); void gen_runarray47(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 1063 "runarray.in" +#line 1028 "runarray.in" {Stack->push<realarray2*>(Identity(n)); return;} } -// Return the diagonal matrix with diagonal entries given by a. -#line 1068 "runarray.in" -void diagonal(stack *Stack) -{ - realarray * a=vm::pop<realarray *>(Stack); -#line 1069 "runarray.in" - size_t n=checkArray(a); - array *c=new array(n); - for(size_t i=0; i < n; ++i) { - array *ci=new array(n); - (*c)[i]=ci; - for(size_t j=0; j < i; ++j) - (*ci)[j]=0.0; - (*ci)[i]=read<real>(a,i); - for(size_t j=i+1; j < n; ++j) - (*ci)[j]=0.0; - } - {Stack->push<realarray2*>(c); return;} -} - // Return the inverse of an n x n matrix a using Gauss-Jordan elimination. -#line 1085 "runarray.in" +#line 1033 "runarray.in" // realarray2* inverse(realarray2 *a); -void gen_runarray49(stack *Stack) +void gen_runarray48(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1086 "runarray.in" +#line 1034 "runarray.in" a=copyArray2(a); size_t n=checkArray(a); checkSquare(a); @@ -1414,14 +1399,14 @@ void gen_runarray49(stack *Stack) // Solve the linear equation ax=b by LU decomposition, returning the // solution x, where a is an n x n matrix and b is an array of length n. // If no solution exists, return an empty array. -#line 1179 "runarray.in" +#line 1127 "runarray.in" // realarray* solve(realarray2 *a, realarray *b, bool warn=true); -void gen_runarray50(stack *Stack) +void gen_runarray49(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1180 "runarray.in" +#line 1128 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray*>(new array(0)); return;} @@ -1429,7 +1414,8 @@ void gen_runarray50(stack *Stack) size_t m=checkArray(b); if(m != n) error(incommensurate); - real *A=copyArray2C(a); + real *A; + copyArray2C(A,a); size_t *index=new size_t[n]; if(LUdecompose(A,n,index,warn) == 0) @@ -1437,7 +1423,8 @@ void gen_runarray50(stack *Stack) array *x=new array(n); - real *B=copyArrayC(b); + real *B; + copyArrayC(B,b); for(size_t i=0; i < n; ++i) { size_t ip=index[i]; @@ -1471,14 +1458,14 @@ void gen_runarray50(stack *Stack) // Solve the linear equation ax=b by LU decomposition, returning the // solution x, where a is an n x n matrix and b is an n x m matrix. // If no solution exists, return an empty array. -#line 1230 "runarray.in" +#line 1180 "runarray.in" // realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true); -void gen_runarray51(stack *Stack) +void gen_runarray50(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1231 "runarray.in" +#line 1181 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray2*>(new array(0)); return;} @@ -1486,8 +1473,9 @@ void gen_runarray51(stack *Stack) if(checkArray(b) != n) error(incommensurate); size_t m=checkArray(read<array*>(b,0)); - real *A=copyArray2C(a); - real *B=copyArray2C(b,false); + real *A,*B; + copyArray2C(A,a); + copyArray2C(B,b,false); size_t *index=new size_t[n]; @@ -1539,13 +1527,14 @@ void gen_runarray51(stack *Stack) } // Compute the determinant of an n x n matrix. -#line 1292 "runarray.in" +#line 1243 "runarray.in" // real determinant(realarray2 *a); -void gen_runarray52(stack *Stack) +void gen_runarray51(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1293 "runarray.in" - real *A=copyArray2C(a); +#line 1244 "runarray.in" + real *A; + copyArray2C(A,a); size_t n=checkArray(a); real det=LUdecompose(A,n,NULL,false); @@ -1558,17 +1547,18 @@ void gen_runarray52(stack *Stack) {Stack->push<real>(det); return;} } -#line 1307 "runarray.in" +#line 1259 "runarray.in" // realarray* *(realarray2 *a, realarray *b); -void gen_runarray53(stack *Stack) +void gen_runarray52(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1308 "runarray.in" +#line 1260 "runarray.in" size_t n=checkArray(a); size_t m=checkArray(b); array *c=new array(n); - real *B=copyArrayC(b); + real *B; + copyArrayC(B,b); for(size_t i=0; i < n; ++i) { array *ai=read<array*>(a,i); if(checkArray(ai) != m) error(incommensurate); @@ -1581,16 +1571,17 @@ void gen_runarray53(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1325 "runarray.in" +#line 1278 "runarray.in" // realarray* *(realarray *a, realarray2 *b); -void gen_runarray54(stack *Stack) +void gen_runarray53(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1326 "runarray.in" +#line 1279 "runarray.in" size_t n=checkArray(a); if(n != checkArray(b)) error(incommensurate); - real *A=copyArrayC(a); + real *A; + copyArrayC(A,a); array **B=new array*[n]; array *bk=read<array *>(b,0); @@ -1614,63 +1605,53 @@ void gen_runarray54(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1353 "runarray.in" +#line 1307 "runarray.in" +// Intarray2* *(Intarray2 *a, Intarray2 *b); +void gen_runarray54(stack *Stack) +{ + Intarray2 * b=vm::pop<Intarray2 *>(Stack); + Intarray2 * a=vm::pop<Intarray2 *>(Stack); +#line 1308 "runarray.in" + {Stack->push<Intarray2*>(mult<Int>(a,b)); return;} +} + +#line 1312 "runarray.in" // realarray2* *(realarray2 *a, realarray2 *b); void gen_runarray55(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1354 "runarray.in" - size_t n=checkArray(a); - - size_t nb=checkArray(b); - size_t na0=n == 0 ? 0 : checkArray(read<array*>(a,0)); - if(na0 != nb) - error(incommensurate); - - size_t nb0=nb == 0 ? 0 : checkArray(read<array*>(b,0)); - - array *c=new array(n); - - real *A=copyArray2C(a,false); - real *B=copyArray2C(b,false); +#line 1313 "runarray.in" + {Stack->push<realarray2*>(mult<real>(a,b)); return;} +} - for(size_t i=0; i < n; ++i) { - real *Ai=A+i*nb; - array *ci=new array(nb0); - (*c)[i]=ci; - for(size_t j=0; j < nb0; ++j) { - real sum=0.0; - size_t kj=j; - for(size_t k=0; k < nb; ++k, kj += nb0) - sum += Ai[k]*B[kj]; - (*ci)[j]=sum; - } - } - - delete[] B; - delete[] A; - - {Stack->push<realarray2*>(c); return;} +#line 1317 "runarray.in" +// pairarray2* *(pairarray2 *a, pairarray2 *b); +void gen_runarray56(stack *Stack) +{ + pairarray2 * b=vm::pop<pairarray2 *>(Stack); + pairarray2 * a=vm::pop<pairarray2 *>(Stack); +#line 1318 "runarray.in" + {Stack->push<pairarray2*>(mult<pair>(a,b)); return;} } -#line 1388 "runarray.in" +#line 1322 "runarray.in" // triple *(realarray2 *t, triple v); -void gen_runarray56(stack *Stack) +void gen_runarray57(stack *Stack) { triple v=vm::pop<triple>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 1389 "runarray.in" +#line 1323 "runarray.in" {Stack->push<triple>(*t*v); return;} } -#line 1393 "runarray.in" +#line 1327 "runarray.in" // pair project(triple v, realarray2 *t); -void gen_runarray57(stack *Stack) +void gen_runarray58(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); triple v=vm::pop<triple>(Stack); -#line 1394 "runarray.in" +#line 1328 "runarray.in" size_t n=checkArray(t); if(n != 4) error(incommensurate); array *t0=read<array*>(t,0); @@ -1695,13 +1676,13 @@ void gen_runarray57(stack *Stack) } // Compute the dot product of vectors a and b. -#line 1419 "runarray.in" +#line 1353 "runarray.in" // real dot(realarray *a, realarray *b); -void gen_runarray58(stack *Stack) +void gen_runarray59(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1420 "runarray.in" +#line 1354 "runarray.in" size_t n=checkArrays(a,b); real sum=0.0; for(size_t i=0; i < n; ++i) @@ -1709,6 +1690,21 @@ void gen_runarray58(stack *Stack) {Stack->push<real>(sum); return;} } +// Compute the complex dot product of vectors a and b. +#line 1363 "runarray.in" +// pair dot(pairarray *a, pairarray *b); +void gen_runarray60(stack *Stack) +{ + pairarray * b=vm::pop<pairarray *>(Stack); + pairarray * a=vm::pop<pairarray *>(Stack); +#line 1364 "runarray.in" + size_t n=checkArrays(a,b); + pair sum=zero; + for(size_t i=0; i < n; ++i) + sum += read<pair>(a,i)*conj(read<pair>(b,i)); + {Stack->push<pair>(sum); return;} +} + // Solve the problem L\inv f, where f is an n vector and L is the n x n matrix // // [ b[0] c[0] a[0] ] @@ -1716,15 +1712,15 @@ void gen_runarray58(stack *Stack) // [ a[2] b[2] c[2] ] // [ ... ] // [ c[n-1] a[n-1] b[n-1] ] -#line 1435 "runarray.in" +#line 1379 "runarray.in" // realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f); -void gen_runarray59(stack *Stack) +void gen_runarray61(stack *Stack) { realarray * f=vm::pop<realarray *>(Stack); realarray * c=vm::pop<realarray *>(Stack); realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1436 "runarray.in" +#line 1380 "runarray.in" size_t n=checkArrays(a,b); checkEqual(n,checkArray(c)); checkEqual(n,checkArray(f)); @@ -1821,16 +1817,16 @@ void gen_runarray59(stack *Stack) } // Root solve by Newton-Raphson -#line 1533 "runarray.in" +#line 1477 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false); -void gen_runarray60(stack *Stack) +void gen_runarray62(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x=vm::pop<real>(Stack); callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1535 "runarray.in" +#line 1479 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; Int i=0; size_t oldPrec=0; @@ -1876,9 +1872,9 @@ void gen_runarray60(stack *Stack) // Root solve by Newton-Raphson bisection // cf. routine rtsafe (Press et al., Numerical Recipes, 1991). -#line 1581 "runarray.in" +#line 1525 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false); -void gen_runarray61(stack *Stack) +void gen_runarray63(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x2=vm::pop<real>(Stack); @@ -1886,7 +1882,7 @@ void gen_runarray61(stack *Stack) callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1583 "runarray.in" +#line 1527 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; size_t oldPrec=0; if(verbose) @@ -1964,16 +1960,16 @@ void gen_runarray61(stack *Stack) {Stack->push<real>((j == iterations) ? DBL_MAX : x); return;} } -#line 1661 "runarray.in" +#line 1605 "runarray.in" // real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0); -void gen_runarray62(stack *Stack) +void gen_runarray64(stack *Stack) { real dxmax=vm::pop<real>(Stack,0); real acc=vm::pop<real>(Stack,DBL_EPSILON); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); -#line 1663 "runarray.in" +#line 1607 "runarray.in" real integral; if(dxmax <= 0) dxmax=fabs(b-a); Func=f; @@ -1984,13 +1980,13 @@ void gen_runarray62(stack *Stack) } // Compute the fast Fourier transform of a pair array -#line 1674 "runarray.in" +#line 1618 "runarray.in" // pairarray* fft(pairarray *a, Int sign=1); -void gen_runarray63(stack *Stack) +void gen_runarray65(stack *Stack) { Int sign=vm::pop<Int>(Stack,1); pairarray * a=vm::pop<pairarray *>(Stack); -#line 1675 "runarray.in" +#line 1619 "runarray.in" unsigned n=(unsigned) checkArray(a); #ifdef HAVE_LIBFFTW3 array *c=new array(n); @@ -2019,12 +2015,12 @@ void gen_runarray63(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 1704 "runarray.in" +#line 1648 "runarray.in" // Intarray2* triangulate(pairarray *z); -void gen_runarray64(stack *Stack) +void gen_runarray66(stack *Stack) { pairarray * z=vm::pop<pairarray *>(Stack); -#line 1705 "runarray.in" +#line 1649 "runarray.in" size_t nv=checkArray(z); // Call robust version of Gilles Dumoulin's port of Paul Bourke's // triangulation code. @@ -2058,12 +2054,12 @@ void gen_runarray64(stack *Stack) {Stack->push<Intarray2*>(t); return;} } -#line 1739 "runarray.in" +#line 1683 "runarray.in" // real norm(realarray *a); -void gen_runarray65(stack *Stack) +void gen_runarray67(stack *Stack) { realarray * a=vm::pop<realarray *>(Stack); -#line 1740 "runarray.in" +#line 1684 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2073,12 +2069,12 @@ void gen_runarray65(stack *Stack) {Stack->push<real>(M); return;} } -#line 1750 "runarray.in" +#line 1694 "runarray.in" // real norm(realarray2 *a); -void gen_runarray66(stack *Stack) +void gen_runarray68(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1751 "runarray.in" +#line 1695 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2092,12 +2088,12 @@ void gen_runarray66(stack *Stack) {Stack->push<real>(M); return;} } -#line 1765 "runarray.in" +#line 1709 "runarray.in" // real norm(triplearray2 *a); -void gen_runarray67(stack *Stack) +void gen_runarray69(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1766 "runarray.in" +#line 1710 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2111,12 +2107,12 @@ void gen_runarray67(stack *Stack) {Stack->push<real>(sqrt(M)); return;} } -#line 1780 "runarray.in" +#line 1724 "runarray.in" // real change2(triplearray2 *a); -void gen_runarray68(stack *Stack) +void gen_runarray70(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1781 "runarray.in" +#line 1725 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<real>(0.0); return;} @@ -2137,13 +2133,13 @@ void gen_runarray68(stack *Stack) {Stack->push<real>(M); return;} } -#line 1802 "runarray.in" +#line 1746 "runarray.in" // triple minbezier(triplearray2 *P, triple b); -void gen_runarray69(stack *Stack) +void gen_runarray71(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1803 "runarray.in" +#line 1747 "runarray.in" real *A=copyTripleArray2Components(P,true,4); b=triple(bound(A,::min,b.getx(),sqrtFuzz*norm(A,16)), bound(A+16,::min,b.gety(),sqrtFuzz*norm(A+16,16)), @@ -2152,13 +2148,13 @@ void gen_runarray69(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1812 "runarray.in" +#line 1756 "runarray.in" // triple maxbezier(triplearray2 *P, triple b); -void gen_runarray70(stack *Stack) +void gen_runarray72(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1813 "runarray.in" +#line 1757 "runarray.in" real *A=copyTripleArray2Components(P,true,4); b=triple(bound(A,::max,b.getx(),sqrtFuzz*norm(A,16)), bound(A+16,::max,b.gety(),sqrtFuzz*norm(A+16,16)), @@ -2167,14 +2163,15 @@ void gen_runarray70(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1822 "runarray.in" +#line 1766 "runarray.in" // pair minratio(triplearray2 *P, pair b); -void gen_runarray71(stack *Stack) +void gen_runarray73(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1823 "runarray.in" - triple *A=copyTripleArray2C(P,true,4); +#line 1767 "runarray.in" + triple *A; + copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::min,xratio,b.getx(),fuzz), bound(A,::min,yratio,b.gety(),fuzz)); @@ -2182,14 +2179,15 @@ void gen_runarray71(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1832 "runarray.in" +#line 1777 "runarray.in" // pair maxratio(triplearray2 *P, pair b); -void gen_runarray72(stack *Stack) +void gen_runarray74(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1833 "runarray.in" - triple *A=copyTripleArray2C(P,true,4); +#line 1778 "runarray.in" + triple *A; + copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::max,xratio,b.getx(),fuzz), bound(A,::max,yratio,b.gety(),fuzz)); @@ -2197,11 +2195,11 @@ void gen_runarray72(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1842 "runarray.in" +#line 1788 "runarray.in" // realarray* _projection(); -void gen_runarray73(stack *Stack) +void gen_runarray75(stack *Stack) { -#line 1843 "runarray.in" +#line 1789 "runarray.in" #ifdef HAVE_GL array *a=new array(14); gl::projection P=gl::camera(); @@ -2238,154 +2236,158 @@ namespace trans { void gen_runarray_venv(venv &ve) { -#line 478 "runarray.in" +#line 443 "runarray.in" REGISTER_BLTIN(run::emptyArray,"emptyArray"); -#line 484 "runarray.in" +#line 449 "runarray.in" REGISTER_BLTIN(run::newDeepArray,"newDeepArray"); -#line 506 "runarray.in" +#line 471 "runarray.in" REGISTER_BLTIN(run::newInitializedArray,"newInitializedArray"); -#line 521 "runarray.in" +#line 486 "runarray.in" REGISTER_BLTIN(run::newAppendedArray,"newAppendedArray"); -#line 537 "runarray.in" +#line 502 "runarray.in" REGISTER_BLTIN(run::newDuplicateArray,"newDuplicateArray"); -#line 547 "runarray.in" +#line 512 "runarray.in" REGISTER_BLTIN(run::arrayRead,"arrayRead"); -#line 559 "runarray.in" +#line 524 "runarray.in" REGISTER_BLTIN(run::arraySliceRead,"arraySliceRead"); -#line 566 "runarray.in" +#line 531 "runarray.in" REGISTER_BLTIN(run::arraySliceReadToEnd,"arraySliceReadToEnd"); -#line 574 "runarray.in" +#line 539 "runarray.in" REGISTER_BLTIN(run::arrayArrayRead,"arrayArrayRead"); -#line 583 "runarray.in" +#line 548 "runarray.in" REGISTER_BLTIN(run::arrayWrite,"arrayWrite"); -#line 599 "runarray.in" +#line 564 "runarray.in" REGISTER_BLTIN(run::arraySliceWrite,"arraySliceWrite"); -#line 607 "runarray.in" +#line 572 "runarray.in" REGISTER_BLTIN(run::arraySliceWriteToEnd,"arraySliceWriteToEnd"); -#line 615 "runarray.in" +#line 580 "runarray.in" REGISTER_BLTIN(run::arrayLength,"arrayLength"); -#line 621 "runarray.in" +#line 586 "runarray.in" REGISTER_BLTIN(run::arrayKeys,"arrayKeys"); -#line 636 "runarray.in" +#line 601 "runarray.in" REGISTER_BLTIN(run::arrayCyclicFlag,"arrayCyclicFlag"); -#line 643 "runarray.in" +#line 608 "runarray.in" REGISTER_BLTIN(run::arraySetCyclicFlag,"arraySetCyclicFlag"); -#line 650 "runarray.in" +#line 615 "runarray.in" REGISTER_BLTIN(run::arrayInitializedHelper,"arrayInitializedHelper"); -#line 661 "runarray.in" +#line 626 "runarray.in" REGISTER_BLTIN(run::arrayInitialized,"arrayInitialized"); -#line 667 "runarray.in" +#line 632 "runarray.in" REGISTER_BLTIN(run::arrayCyclicHelper,"arrayCyclicHelper"); -#line 674 "runarray.in" +#line 639 "runarray.in" REGISTER_BLTIN(run::arrayCyclic,"arrayCyclic"); -#line 680 "runarray.in" +#line 645 "runarray.in" REGISTER_BLTIN(run::arrayPushHelper,"arrayPushHelper"); -#line 688 "runarray.in" +#line 653 "runarray.in" REGISTER_BLTIN(run::arrayPush,"arrayPush"); -#line 694 "runarray.in" +#line 659 "runarray.in" REGISTER_BLTIN(run::arrayAppendHelper,"arrayAppendHelper"); -#line 703 "runarray.in" +#line 668 "runarray.in" REGISTER_BLTIN(run::arrayAppend,"arrayAppend"); -#line 709 "runarray.in" +#line 674 "runarray.in" REGISTER_BLTIN(run::arrayPopHelper,"arrayPopHelper"); -#line 718 "runarray.in" +#line 683 "runarray.in" REGISTER_BLTIN(run::arrayPop,"arrayPop"); -#line 724 "runarray.in" +#line 689 "runarray.in" REGISTER_BLTIN(run::arrayInsertHelper,"arrayInsertHelper"); -#line 735 "runarray.in" +#line 700 "runarray.in" REGISTER_BLTIN(run::arrayInsert,"arrayInsert"); -#line 741 "runarray.in" +#line 706 "runarray.in" REGISTER_BLTIN(run::arrayDelete,"arrayDelete"); -#line 747 "runarray.in" +#line 712 "runarray.in" REGISTER_BLTIN(run::arrayAlias,"arrayAlias"); -#line 752 "runarray.in" +#line 717 "runarray.in" REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray"); -#line 770 "runarray.in" +#line 735 "runarray.in" addFunc(ve, run::gen_runarray31, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false)); -#line 789 "runarray.in" +#line 754 "runarray.in" REGISTER_BLTIN(run::arraySequence,"arraySequence"); -#line 802 "runarray.in" +#line 767 "runarray.in" addFunc(ve, run::gen_runarray33, IntArray(), "sequence", formal(primInt(), "n", false, false)); -#line 813 "runarray.in" +#line 778 "runarray.in" REGISTER_BLTIN(run::arrayFunction,"arrayFunction"); -#line 826 "runarray.in" +#line 791 "runarray.in" REGISTER_BLTIN(run::arraySort,"arraySort"); -#line 835 "runarray.in" +#line 800 "runarray.in" addFunc(ve, run::gen_runarray36, primBoolean(), "all", formal(booleanArray(), "a", false, false)); -#line 844 "runarray.in" +#line 809 "runarray.in" addFunc(ve, run::gen_runarray37, booleanArray(), "!", formal(booleanArray(), "a", false, false)); -#line 853 "runarray.in" +#line 818 "runarray.in" addFunc(ve, run::gen_runarray38, primInt(), "sum", formal(booleanArray(), "a", false, false)); -#line 862 "runarray.in" +#line 827 "runarray.in" REGISTER_BLTIN(run::arrayCopy,"arrayCopy"); -#line 867 "runarray.in" +#line 832 "runarray.in" REGISTER_BLTIN(run::arrayConcat,"arrayConcat"); -#line 895 "runarray.in" +#line 860 "runarray.in" REGISTER_BLTIN(run::array2Copy,"array2Copy"); -#line 900 "runarray.in" +#line 865 "runarray.in" REGISTER_BLTIN(run::array3Copy,"array3Copy"); -#line 905 "runarray.in" +#line 870 "runarray.in" REGISTER_BLTIN(run::array2Transpose,"array2Transpose"); -#line 929 "runarray.in" +#line 894 "runarray.in" REGISTER_BLTIN(run::array3Transpose,"array3Transpose"); -#line 1016 "runarray.in" +#line 981 "runarray.in" addFunc(ve, run::gen_runarray45, primInt(), "find", formal(booleanArray(), "a", false, false), formal(primInt(), "n", true, false)); -#line 1035 "runarray.in" +#line 1000 "runarray.in" REGISTER_BLTIN(run::arrayConditional,"arrayConditional"); -#line 1061 "runarray.in" +#line 1026 "runarray.in" addFunc(ve, run::gen_runarray47, realArray2(), "identity", formal(primInt(), "n", false, false)); -#line 1067 "runarray.in" - REGISTER_BLTIN(run::diagonal,"diagonal"); -#line 1084 "runarray.in" - addFunc(ve, run::gen_runarray49, realArray2(), "inverse", formal(realArray2(), "a", false, false)); -#line 1176 "runarray.in" - addFunc(ve, run::gen_runarray50, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 1227 "runarray.in" - addFunc(ve, run::gen_runarray51, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 1291 "runarray.in" - addFunc(ve, run::gen_runarray52, primReal(), "determinant", formal(realArray2(), "a", false, false)); +#line 1032 "runarray.in" + addFunc(ve, run::gen_runarray48, realArray2(), "inverse", formal(realArray2(), "a", false, false)); +#line 1124 "runarray.in" + addFunc(ve, run::gen_runarray49, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false)); +#line 1177 "runarray.in" + addFunc(ve, run::gen_runarray50, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false)); +#line 1242 "runarray.in" + addFunc(ve, run::gen_runarray51, primReal(), "determinant", formal(realArray2(), "a", false, false)); +#line 1259 "runarray.in" + addFunc(ve, run::gen_runarray52, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false)); +#line 1278 "runarray.in" + addFunc(ve, run::gen_runarray53, realArray(), "*", formal(realArray(), "a", false, false), formal(realArray2(), "b", false, false)); #line 1307 "runarray.in" - addFunc(ve, run::gen_runarray53, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false)); -#line 1325 "runarray.in" - addFunc(ve, run::gen_runarray54, realArray(), "*", formal(realArray(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 1353 "runarray.in" + addFunc(ve, run::gen_runarray54, IntArray2(), "*", formal(IntArray2(), "a", false, false), formal(IntArray2(), "b", false, false)); +#line 1312 "runarray.in" addFunc(ve, run::gen_runarray55, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 1388 "runarray.in" - addFunc(ve, run::gen_runarray56, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false)); -#line 1393 "runarray.in" - addFunc(ve, run::gen_runarray57, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false)); -#line 1418 "runarray.in" - addFunc(ve, run::gen_runarray58, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false)); -#line 1428 "runarray.in" - addFunc(ve, run::gen_runarray59, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false)); -#line 1532 "runarray.in" - addFunc(ve, run::gen_runarray60, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false)); -#line 1579 "runarray.in" - addFunc(ve, run::gen_runarray61, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false)); -#line 1661 "runarray.in" - addFunc(ve, run::gen_runarray62, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false)); -#line 1673 "runarray.in" - addFunc(ve, run::gen_runarray63, pairArray(), "fft", formal(pairArray(), "a", false, false), formal(primInt(), "sign", true, false)); -#line 1704 "runarray.in" - addFunc(ve, run::gen_runarray64, IntArray2(), "triangulate", formal(pairArray(), "z", false, false)); -#line 1739 "runarray.in" - addFunc(ve, run::gen_runarray65, primReal(), "norm", formal(realArray(), "a", false, false)); -#line 1750 "runarray.in" - addFunc(ve, run::gen_runarray66, primReal(), "norm", formal(realArray2(), "a", false, false)); -#line 1765 "runarray.in" - addFunc(ve, run::gen_runarray67, primReal(), "norm", formal(tripleArray2(), "a", false, false)); -#line 1780 "runarray.in" - addFunc(ve, run::gen_runarray68, primReal(), "change2", formal(tripleArray2(), "a", false, false)); -#line 1802 "runarray.in" - addFunc(ve, run::gen_runarray69, primTriple(), "minbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); -#line 1812 "runarray.in" - addFunc(ve, run::gen_runarray70, primTriple(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); -#line 1822 "runarray.in" - addFunc(ve, run::gen_runarray71, primPair(), "minratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); -#line 1832 "runarray.in" - addFunc(ve, run::gen_runarray72, primPair(), "maxratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); -#line 1842 "runarray.in" - addFunc(ve, run::gen_runarray73, realArray(), "_projection"); +#line 1317 "runarray.in" + addFunc(ve, run::gen_runarray56, pairArray2(), "*", formal(pairArray2(), "a", false, false), formal(pairArray2(), "b", false, false)); +#line 1322 "runarray.in" + addFunc(ve, run::gen_runarray57, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false)); +#line 1327 "runarray.in" + addFunc(ve, run::gen_runarray58, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false)); +#line 1352 "runarray.in" + addFunc(ve, run::gen_runarray59, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false)); +#line 1362 "runarray.in" + addFunc(ve, run::gen_runarray60, primPair(), "dot", formal(pairArray(), "a", false, false), formal(pairArray(), "b", false, false)); +#line 1372 "runarray.in" + addFunc(ve, run::gen_runarray61, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false)); +#line 1476 "runarray.in" + addFunc(ve, run::gen_runarray62, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false)); +#line 1523 "runarray.in" + addFunc(ve, run::gen_runarray63, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false)); +#line 1605 "runarray.in" + addFunc(ve, run::gen_runarray64, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false)); +#line 1617 "runarray.in" + addFunc(ve, run::gen_runarray65, pairArray(), "fft", formal(pairArray(), "a", false, false), formal(primInt(), "sign", true, false)); +#line 1648 "runarray.in" + addFunc(ve, run::gen_runarray66, IntArray2(), "triangulate", formal(pairArray(), "z", false, false)); +#line 1683 "runarray.in" + addFunc(ve, run::gen_runarray67, primReal(), "norm", formal(realArray(), "a", false, false)); +#line 1694 "runarray.in" + addFunc(ve, run::gen_runarray68, primReal(), "norm", formal(realArray2(), "a", false, false)); +#line 1709 "runarray.in" + addFunc(ve, run::gen_runarray69, primReal(), "norm", formal(tripleArray2(), "a", false, false)); +#line 1724 "runarray.in" + addFunc(ve, run::gen_runarray70, primReal(), "change2", formal(tripleArray2(), "a", false, false)); +#line 1746 "runarray.in" + addFunc(ve, run::gen_runarray71, primTriple(), "minbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); +#line 1756 "runarray.in" + addFunc(ve, run::gen_runarray72, primTriple(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); +#line 1766 "runarray.in" + addFunc(ve, run::gen_runarray73, primPair(), "minratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); +#line 1777 "runarray.in" + addFunc(ve, run::gen_runarray74, primPair(), "maxratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); +#line 1788 "runarray.in" + addFunc(ve, run::gen_runarray75, realArray(), "_projection"); } } // namespace trans diff --git a/Build/source/utils/asymptote/runarray.h b/Build/source/utils/asymptote/runarray.h index 82b61cf0dea..8d2bee30f77 100644 --- a/Build/source/utils/asymptote/runarray.h +++ b/Build/source/utils/asymptote/runarray.h @@ -44,7 +44,6 @@ void array3Copy(vm::stack *); void array2Transpose(vm::stack *); void array3Transpose(vm::stack *); void arrayConditional(vm::stack *); -void diagonal(vm::stack *); } #endif // runarray_H diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in index ac7c6ed6781..7e99a875f4b 100644 --- a/Build/source/utils/asymptote/runarray.in +++ b/Build/source/utils/asymptote/runarray.in @@ -13,6 +13,7 @@ Intarray2* => IntArray2() realarray* => realArray() realarray2* => realArray2() pairarray* => pairArray() +pairarray2* => pairArray2() triplearray2* => tripleArray2() callableReal* => realRealFunction() @@ -31,12 +32,17 @@ callableReal* => realRealFunction() using namespace camp; using namespace vm; +namespace run { +extern pair zero; +} + typedef array boolarray; typedef array Intarray; typedef array Intarray2; typedef array realarray; typedef array realarray2; typedef array pairarray; +typedef array pairarray2; typedef array triplearray2; using types::booleanArray; @@ -45,6 +51,7 @@ using types::IntArray2; using types::realArray; using types::realArray2; using types::pairArray; +using types::pairArray2; using types::tripleArray2; typedef callable callableReal; @@ -116,36 +123,6 @@ array *copyArray(array *a) return c; } -inline size_t checkdimension(const array *a, size_t dim) -{ - size_t size=checkArray(a); - if(dim && size != dim) { - ostringstream buf; - buf << "array of length " << dim << " expected"; - error(buf); - } - return size; -} - -double *copyArrayC(const array *a, size_t dim, GCPlacement placement) -{ - size_t size=checkdimension(a,dim); - double *c=(placement == NoGC) ? new double [size] : - new(placement) double[size]; - for(size_t i=0; i < size; i++) - c[i]=read<double>(a,i); - return c; -} - -triple *copyTripleArrayC(const array *a, size_t dim) -{ - size_t size=checkdimension(a,dim); - triple *c=new triple[size]; - for(size_t i=0; i < size; i++) - c[i]=read<triple>(a,i); - return c; -} - array *copyArray2(array *a) { size_t size=checkArray(a); @@ -182,55 +159,6 @@ array *copyArray3(array *a) return c; } -double *copyArray2C(const array *a, bool square, size_t dim2, - GCPlacement placement) -{ - size_t n=checkArray(a); - size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); - if(n > 0 && dim2 && m != dim2) { - ostringstream buf; - buf << "second matrix dimension must be " << dim2; - error(buf); - } - - double *c=(placement == NoGC) ? new double [n*m] : new(placement) double[n*m]; - for(size_t i=0; i < n; i++) { - array *ai=read<array*>(a,i); - size_t aisize=checkArray(ai); - if(aisize == m) { - double *ci=c+i*m; - for(size_t j=0; j < m; j++) - ci[j]=read<double>(ai,j); - } else - error(square ? "matrix must be square" : "matrix must be rectangular"); - } - return c; -} - -triple *copyTripleArray2C(const array *a, bool square, size_t dim2) -{ - size_t n=checkArray(a); - size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); - if(n > 0 && dim2 && m != dim2) { - ostringstream buf; - buf << "second matrix dimension must be " << dim2; - error(buf); - } - - triple *c=new triple[n*m]; - for(size_t i=0; i < n; i++) { - array *ai=read<array*>(a,i); - size_t aisize=checkArray(ai); - if(aisize == m) { - triple *ci=c+i*m; - for(size_t j=0; j < m; j++) - ci[j]=read<triple>(ai,j); - } else - error(square ? "matrix must be square" : "matrix must be rectangular"); - } - return c; -} - double *copyTripleArray2Components(array *a, bool square, size_t dim2, GCPlacement placement) { @@ -323,6 +251,43 @@ triple multshiftless(const array& t, const triple& v) (read<real>(t2,0)*x+read<real>(t2,1)*y+read<real>(t2,2)*z)*f); } +template<class T> +array *mult(array *a, array *b) +{ + size_t n=checkArray(a); + + size_t nb=checkArray(b); + size_t na0=n == 0 ? 0 : checkArray(read<array*>(a,0)); + if(na0 != nb) + error(incommensurate); + + size_t nb0=nb == 0 ? 0 : checkArray(read<array*>(b,0)); + + array *c=new array(n); + + T *A,*B; + copyArray2C(A,a,false); + copyArray2C(B,b,false); + + for(size_t i=0; i < n; ++i) { + T *Ai=A+i*nb; + array *ci=new array(nb0); + (*c)[i]=ci; + for(size_t j=0; j < nb0; ++j) { + T sum=0.0; + size_t kj=j; + for(size_t k=0; k < nb; ++k, kj += nb0) + sum += Ai[k]*B[kj]; + (*ci)[j]=sum; + } + } + + delete[] B; + delete[] A; + + return c; +} + double norm(double *a, size_t n) { if(n == 0) return 0.0; @@ -1064,23 +1029,6 @@ realarray2 *identity(Int n) return Identity(n); } -// Return the diagonal matrix with diagonal entries given by a. -realarray2* :diagonal(realarray *a) -{ - size_t n=checkArray(a); - array *c=new array(n); - for(size_t i=0; i < n; ++i) { - array *ci=new array(n); - (*c)[i]=ci; - for(size_t j=0; j < i; ++j) - (*ci)[j]=0.0; - (*ci)[i]=read<real>(a,i); - for(size_t j=i+1; j < n; ++j) - (*ci)[j]=0.0; - } - return c; -} - // Return the inverse of an n x n matrix a using Gauss-Jordan elimination. realarray2 *inverse(realarray2 *a) { @@ -1185,7 +1133,8 @@ realarray *solve(realarray2 *a, realarray *b, bool warn=true) size_t m=checkArray(b); if(m != n) error(incommensurate); - real *A=copyArray2C(a); + real *A; + copyArray2C(A,a); size_t *index=new size_t[n]; if(LUdecompose(A,n,index,warn) == 0) @@ -1193,7 +1142,8 @@ realarray *solve(realarray2 *a, realarray *b, bool warn=true) array *x=new array(n); - real *B=copyArrayC(b); + real *B; + copyArrayC(B,b); for(size_t i=0; i < n; ++i) { size_t ip=index[i]; @@ -1236,8 +1186,9 @@ realarray2 *solve(realarray2 *a, realarray2 *b, bool warn=true) if(checkArray(b) != n) error(incommensurate); size_t m=checkArray(read<array*>(b,0)); - real *A=copyArray2C(a); - real *B=copyArray2C(b,false); + real *A,*B; + copyArray2C(A,a); + copyArray2C(B,b,false); size_t *index=new size_t[n]; @@ -1291,7 +1242,8 @@ realarray2 *solve(realarray2 *a, realarray2 *b, bool warn=true) // Compute the determinant of an n x n matrix. real determinant(realarray2 *a) { - real *A=copyArray2C(a); + real *A; + copyArray2C(A,a); size_t n=checkArray(a); real det=LUdecompose(A,n,NULL,false); @@ -1309,7 +1261,8 @@ realarray *Operator *(realarray2 *a, realarray *b) size_t n=checkArray(a); size_t m=checkArray(b); array *c=new array(n); - real *B=copyArrayC(b); + real *B; + copyArrayC(B,b); for(size_t i=0; i < n; ++i) { array *ai=read<array*>(a,i); if(checkArray(ai) != m) error(incommensurate); @@ -1326,7 +1279,8 @@ realarray *Operator *(realarray *a, realarray2 *b) { size_t n=checkArray(a); if(n != checkArray(b)) error(incommensurate); - real *A=copyArrayC(a); + real *A; + copyArrayC(A,a); array **B=new array*[n]; array *bk=read<array *>(b,0); @@ -1350,39 +1304,19 @@ realarray *Operator *(realarray *a, realarray2 *b) return c; } +Intarray2 *Operator *(Intarray2 *a, Intarray2 *b) +{ + return mult<Int>(a,b); +} + realarray2 *Operator *(realarray2 *a, realarray2 *b) { - size_t n=checkArray(a); - - size_t nb=checkArray(b); - size_t na0=n == 0 ? 0 : checkArray(read<array*>(a,0)); - if(na0 != nb) - error(incommensurate); - - size_t nb0=nb == 0 ? 0 : checkArray(read<array*>(b,0)); - - array *c=new array(n); - - real *A=copyArray2C(a,false); - real *B=copyArray2C(b,false); - - for(size_t i=0; i < n; ++i) { - real *Ai=A+i*nb; - array *ci=new array(nb0); - (*c)[i]=ci; - for(size_t j=0; j < nb0; ++j) { - real sum=0.0; - size_t kj=j; - for(size_t k=0; k < nb; ++k, kj += nb0) - sum += Ai[k]*B[kj]; - (*ci)[j]=sum; - } - } - - delete[] B; - delete[] A; - - return c; + return mult<real>(a,b); +} + +pairarray2 *Operator *(pairarray2 *a, pairarray2 *b) +{ + return mult<pair>(a,b); } triple Operator *(realarray2 *t, triple v) @@ -1425,6 +1359,16 @@ real dot(realarray *a, realarray *b) return sum; } +// Compute the complex dot product of vectors a and b. +pair dot(pairarray *a, pairarray *b) +{ + size_t n=checkArrays(a,b); + pair sum=zero; + for(size_t i=0; i < n; ++i) + sum += read<pair>(a,i)*conj(read<pair>(b,i)); + return sum; +} + // Solve the problem L\inv f, where f is an n vector and L is the n x n matrix // // [ b[0] c[0] a[0] ] @@ -1821,7 +1765,8 @@ triple maxbezier(triplearray2 *P, triple b) pair minratio(triplearray2 *P, pair b) { - triple *A=copyTripleArray2C(P,true,4); + triple *A; + copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::min,xratio,b.getx(),fuzz), bound(A,::min,yratio,b.gety(),fuzz)); @@ -1831,7 +1776,8 @@ pair minratio(triplearray2 *P, pair b) pair maxratio(triplearray2 *P, pair b) { - triple *A=copyTripleArray2C(P,true,4); + triple *A; + copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::max,xratio,b.getx(),fuzz), bound(A,::max,yratio,b.gety(),fuzz)); diff --git a/Build/source/utils/asymptote/runbacktrace.cc b/Build/source/utils/asymptote/runbacktrace.cc index 7e25c6be058..8d8c8ff0447 100644 --- a/Build/source/utils/asymptote/runbacktrace.cc +++ b/Build/source/utils/asymptote/runbacktrace.cc @@ -32,6 +32,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -50,12 +51,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runfile.cc b/Build/source/utils/asymptote/runfile.cc index c82d772eb4e..1351be016d1 100644 --- a/Build/source/utils/asymptote/runfile.cc +++ b/Build/source/utils/asymptote/runfile.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runhistory.cc b/Build/source/utils/asymptote/runhistory.cc index 8bf35726c8c..7bc7d456acf 100644 --- a/Build/source/utils/asymptote/runhistory.cc +++ b/Build/source/utils/asymptote/runhistory.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runlabel.cc b/Build/source/utils/asymptote/runlabel.cc index f3edc8243e2..7c10a605f33 100644 --- a/Build/source/utils/asymptote/runlabel.cc +++ b/Build/source/utils/asymptote/runlabel.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runmath.cc b/Build/source/utils/asymptote/runmath.cc index e11edb3455d..ed73781d84e 100644 --- a/Build/source/utils/asymptote/runmath.cc +++ b/Build/source/utils/asymptote/runmath.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } @@ -172,7 +213,7 @@ void gen_runmath4(stack *Stack) void gen_runmath5(stack *Stack) { #line 91 "runmath.in" - {Stack->push<Int>(rand()); return;} + {Stack->push<Int>(random()); return;} } #line 95 "runmath.in" @@ -181,169 +222,171 @@ void gen_runmath6(stack *Stack) { Int seed=vm::pop<Int>(Stack); #line 96 "runmath.in" - srand(intcast(seed)); + const int n=256; + static char state[n]; + initstate(intcast(seed),state,n); } // a random number uniformly distributed in the interval [0,1] -#line 101 "runmath.in" +#line 103 "runmath.in" // real unitrand(); void gen_runmath7(stack *Stack) { -#line 102 "runmath.in" - {Stack->push<real>(((real) rand())/RAND_MAX); return;} +#line 104 "runmath.in" + {Stack->push<real>(((real) random())/RAND_MAX); return;} } -#line 106 "runmath.in" +#line 108 "runmath.in" // Int ceil(real x); void gen_runmath8(stack *Stack) { real x=vm::pop<real>(Stack); -#line 107 "runmath.in" +#line 109 "runmath.in" {Stack->push<Int>(Intcast(ceil(x))); return;} } -#line 111 "runmath.in" +#line 113 "runmath.in" // Int floor(real x); void gen_runmath9(stack *Stack) { real x=vm::pop<real>(Stack); -#line 112 "runmath.in" +#line 114 "runmath.in" {Stack->push<Int>(Intcast(floor(x))); return;} } -#line 116 "runmath.in" +#line 118 "runmath.in" // Int round(real x); void gen_runmath10(stack *Stack) { real x=vm::pop<real>(Stack); -#line 117 "runmath.in" +#line 119 "runmath.in" if(validInt(x)) {Stack->push<Int>(Round(x)); return;} integeroverflow(0); } -#line 122 "runmath.in" +#line 124 "runmath.in" // Int Ceil(real x); void gen_runmath11(stack *Stack) { real x=vm::pop<real>(Stack); -#line 123 "runmath.in" +#line 125 "runmath.in" {Stack->push<Int>(Ceil(x)); return;} } -#line 127 "runmath.in" +#line 129 "runmath.in" // Int Floor(real x); void gen_runmath12(stack *Stack) { real x=vm::pop<real>(Stack); -#line 128 "runmath.in" +#line 130 "runmath.in" {Stack->push<Int>(Floor(x)); return;} } -#line 132 "runmath.in" +#line 134 "runmath.in" // Int Round(real x); void gen_runmath13(stack *Stack) { real x=vm::pop<real>(Stack); -#line 133 "runmath.in" +#line 135 "runmath.in" {Stack->push<Int>(Round(Intcap(x))); return;} } -#line 137 "runmath.in" +#line 139 "runmath.in" // real fmod(real x, real y); void gen_runmath14(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 138 "runmath.in" +#line 140 "runmath.in" if (y == 0.0) dividebyzero(); {Stack->push<real>(fmod(x,y)); return;} } -#line 143 "runmath.in" +#line 145 "runmath.in" // real atan2(real y, real x); void gen_runmath15(stack *Stack) { real x=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); -#line 144 "runmath.in" +#line 146 "runmath.in" {Stack->push<real>(atan2(y,x)); return;} } -#line 148 "runmath.in" +#line 150 "runmath.in" // real hypot(real x, real y); void gen_runmath16(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 149 "runmath.in" +#line 151 "runmath.in" {Stack->push<real>(hypot(x,y)); return;} } -#line 153 "runmath.in" +#line 155 "runmath.in" // real remainder(real x, real y); void gen_runmath17(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 154 "runmath.in" +#line 156 "runmath.in" {Stack->push<real>(remainder(x,y)); return;} } -#line 158 "runmath.in" +#line 160 "runmath.in" // real Jn(Int n, real x); void gen_runmath18(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 159 "runmath.in" +#line 161 "runmath.in" {Stack->push<real>(jn(n,x)); return;} } -#line 163 "runmath.in" +#line 165 "runmath.in" // real Yn(Int n, real x); void gen_runmath19(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 164 "runmath.in" +#line 166 "runmath.in" {Stack->push<real>(yn(n,x)); return;} } -#line 168 "runmath.in" +#line 170 "runmath.in" // real erf(real x); void gen_runmath20(stack *Stack) { real x=vm::pop<real>(Stack); -#line 169 "runmath.in" +#line 171 "runmath.in" {Stack->push<real>(erf(x)); return;} } -#line 173 "runmath.in" +#line 175 "runmath.in" // real erfc(real x); void gen_runmath21(stack *Stack) { real x=vm::pop<real>(Stack); -#line 174 "runmath.in" +#line 176 "runmath.in" {Stack->push<real>(erfc(x)); return;} } -#line 178 "runmath.in" +#line 180 "runmath.in" // Int factorial(Int n); void gen_runmath22(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 179 "runmath.in" +#line 181 "runmath.in" if(n < 0) error(invalidargument); {Stack->push<Int>(factorial(n)); return;} } -#line 183 "runmath.in" +#line 185 "runmath.in" // Int choose(Int n, Int k); void gen_runmath23(stack *Stack) { Int k=vm::pop<Int>(Stack); Int n=vm::pop<Int>(Stack); -#line 184 "runmath.in" +#line 186 "runmath.in" if(n < 0 || k < 0 || k > n) error(invalidargument); Int f=1; Int r=n-k; @@ -354,12 +397,12 @@ void gen_runmath23(stack *Stack) {Stack->push<Int>(f); return;} } -#line 194 "runmath.in" +#line 196 "runmath.in" // real gamma(real x); void gen_runmath24(stack *Stack) { real x=vm::pop<real>(Stack); -#line 195 "runmath.in" +#line 197 "runmath.in" #ifdef HAVE_TGAMMA {Stack->push<real>(tgamma(x)); return;} #else @@ -368,14 +411,14 @@ void gen_runmath24(stack *Stack) #endif } -#line 204 "runmath.in" +#line 206 "runmath.in" // realarray* quadraticroots(real a, real b, real c); void gen_runmath25(stack *Stack) { real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 205 "runmath.in" +#line 207 "runmath.in" quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -383,14 +426,14 @@ void gen_runmath25(stack *Stack) {Stack->push<realarray*>(roots); return;} } -#line 213 "runmath.in" +#line 215 "runmath.in" // pairarray* quadraticroots(explicit pair a, explicit pair b, explicit pair c); void gen_runmath26(stack *Stack) { pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 214 "runmath.in" +#line 216 "runmath.in" Quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.z1; @@ -398,7 +441,7 @@ void gen_runmath26(stack *Stack) {Stack->push<pairarray*>(roots); return;} } -#line 222 "runmath.in" +#line 224 "runmath.in" // realarray* cubicroots(real a, real b, real c, real d); void gen_runmath27(stack *Stack) { @@ -406,7 +449,7 @@ void gen_runmath27(stack *Stack) real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 223 "runmath.in" +#line 225 "runmath.in" cubicroots q(a,b,c,d); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -417,98 +460,98 @@ void gen_runmath27(stack *Stack) // Logical operations -#line 234 "runmath.in" +#line 236 "runmath.in" // bool !(bool b); void gen_runmath28(stack *Stack) { bool b=vm::pop<bool>(Stack); -#line 235 "runmath.in" +#line 237 "runmath.in" {Stack->push<bool>(!b); return;} } -#line 240 "runmath.in" +#line 242 "runmath.in" void boolMemEq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 241 "runmath.in" +#line 243 "runmath.in" {Stack->push<bool>(a == b); return;} } -#line 245 "runmath.in" +#line 247 "runmath.in" void boolMemNeq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 246 "runmath.in" +#line 248 "runmath.in" {Stack->push<bool>(a != b); return;} } -#line 250 "runmath.in" +#line 252 "runmath.in" void boolFuncEq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 251 "runmath.in" +#line 253 "runmath.in" {Stack->push<bool>(a->compare(b)); return;} } -#line 255 "runmath.in" +#line 257 "runmath.in" void boolFuncNeq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 256 "runmath.in" +#line 258 "runmath.in" {Stack->push<bool>(!(a->compare(b))); return;} } // Bit operations -#line 262 "runmath.in" +#line 264 "runmath.in" // Int AND(Int a, Int b); void gen_runmath33(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 263 "runmath.in" +#line 265 "runmath.in" {Stack->push<Int>(a & b); return;} } -#line 268 "runmath.in" +#line 270 "runmath.in" // Int OR(Int a, Int b); void gen_runmath34(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 269 "runmath.in" +#line 271 "runmath.in" {Stack->push<Int>(a | b); return;} } -#line 273 "runmath.in" +#line 275 "runmath.in" // Int XOR(Int a, Int b); void gen_runmath35(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 274 "runmath.in" +#line 276 "runmath.in" {Stack->push<Int>(a ^ b); return;} } -#line 278 "runmath.in" +#line 280 "runmath.in" // Int NOT(Int a); void gen_runmath36(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 279 "runmath.in" +#line 281 "runmath.in" {Stack->push<Int>(~a); return;} } -#line 283 "runmath.in" +#line 285 "runmath.in" // Int CLZ(Int a); void gen_runmath37(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 284 "runmath.in" +#line 286 "runmath.in" if((unsignedInt) a > 0xFFFFFFFF) {Stack->push<Int>(-1); return;} #ifdef __GNUC__ {Stack->push<Int>(__builtin_clz(a)); return;} @@ -529,12 +572,12 @@ void gen_runmath37(stack *Stack) #endif } -#line 305 "runmath.in" +#line 307 "runmath.in" // Int CTZ(Int a); void gen_runmath38(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 306 "runmath.in" +#line 308 "runmath.in" if((unsignedInt) a > 0xFFFFFFFF) {Stack->push<Int>(-1); return;} #ifdef __GNUC__ {Stack->push<Int>(__builtin_ctz(a)); return;} @@ -569,69 +612,69 @@ void gen_runmath_venv(venv &ve) addFunc(ve, run::gen_runmath5, primInt(), "rand"); #line 95 "runmath.in" addFunc(ve, run::gen_runmath6, primVoid(), "srand", formal(primInt(), "seed", false, false)); -#line 100 "runmath.in" +#line 102 "runmath.in" addFunc(ve, run::gen_runmath7, primReal(), "unitrand"); -#line 106 "runmath.in" +#line 108 "runmath.in" addFunc(ve, run::gen_runmath8, primInt(), "ceil", formal(primReal(), "x", false, false)); -#line 111 "runmath.in" +#line 113 "runmath.in" addFunc(ve, run::gen_runmath9, primInt(), "floor", formal(primReal(), "x", false, false)); -#line 116 "runmath.in" +#line 118 "runmath.in" addFunc(ve, run::gen_runmath10, primInt(), "round", formal(primReal(), "x", false, false)); -#line 122 "runmath.in" +#line 124 "runmath.in" addFunc(ve, run::gen_runmath11, primInt(), "Ceil", formal(primReal(), "x", false, false)); -#line 127 "runmath.in" +#line 129 "runmath.in" addFunc(ve, run::gen_runmath12, primInt(), "Floor", formal(primReal(), "x", false, false)); -#line 132 "runmath.in" +#line 134 "runmath.in" addFunc(ve, run::gen_runmath13, primInt(), "Round", formal(primReal(), "x", false, false)); -#line 137 "runmath.in" +#line 139 "runmath.in" addFunc(ve, run::gen_runmath14, primReal(), "fmod", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 143 "runmath.in" +#line 145 "runmath.in" addFunc(ve, run::gen_runmath15, primReal(), "atan2", formal(primReal(), "y", false, false), formal(primReal(), "x", false, false)); -#line 148 "runmath.in" +#line 150 "runmath.in" addFunc(ve, run::gen_runmath16, primReal(), "hypot", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 153 "runmath.in" +#line 155 "runmath.in" addFunc(ve, run::gen_runmath17, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 158 "runmath.in" +#line 160 "runmath.in" addFunc(ve, run::gen_runmath18, primReal(), "Jn", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); -#line 163 "runmath.in" +#line 165 "runmath.in" addFunc(ve, run::gen_runmath19, primReal(), "Yn", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); -#line 168 "runmath.in" +#line 170 "runmath.in" addFunc(ve, run::gen_runmath20, primReal(), "erf", formal(primReal(), "x", false, false)); -#line 173 "runmath.in" +#line 175 "runmath.in" addFunc(ve, run::gen_runmath21, primReal(), "erfc", formal(primReal(), "x", false, false)); -#line 178 "runmath.in" +#line 180 "runmath.in" addFunc(ve, run::gen_runmath22, primInt(), "factorial", formal(primInt(), "n", false, false)); -#line 183 "runmath.in" +#line 185 "runmath.in" addFunc(ve, run::gen_runmath23, primInt(), "choose", formal(primInt(), "n", false, false), formal(primInt(), "k", false, false)); -#line 194 "runmath.in" +#line 196 "runmath.in" addFunc(ve, run::gen_runmath24, primReal(), "gamma", formal(primReal(), "x", false, false)); -#line 204 "runmath.in" +#line 206 "runmath.in" addFunc(ve, run::gen_runmath25, realArray(), "quadraticroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false)); -#line 213 "runmath.in" +#line 215 "runmath.in" addFunc(ve, run::gen_runmath26, pairArray(), "quadraticroots", formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primPair(), "c", false, true)); -#line 222 "runmath.in" +#line 224 "runmath.in" addFunc(ve, run::gen_runmath27, realArray(), "cubicroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false), formal(primReal(), "d", false, false)); -#line 232 "runmath.in" +#line 234 "runmath.in" addFunc(ve, run::gen_runmath28, primBoolean(), "!", formal(primBoolean(), "b", false, false)); -#line 240 "runmath.in" +#line 242 "runmath.in" REGISTER_BLTIN(run::boolMemEq,"boolMemEq"); -#line 245 "runmath.in" +#line 247 "runmath.in" REGISTER_BLTIN(run::boolMemNeq,"boolMemNeq"); -#line 250 "runmath.in" +#line 252 "runmath.in" REGISTER_BLTIN(run::boolFuncEq,"boolFuncEq"); -#line 255 "runmath.in" +#line 257 "runmath.in" REGISTER_BLTIN(run::boolFuncNeq,"boolFuncNeq"); -#line 260 "runmath.in" +#line 262 "runmath.in" addFunc(ve, run::gen_runmath33, primInt(), "AND", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 268 "runmath.in" +#line 270 "runmath.in" addFunc(ve, run::gen_runmath34, primInt(), "OR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 273 "runmath.in" +#line 275 "runmath.in" addFunc(ve, run::gen_runmath35, primInt(), "XOR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 278 "runmath.in" +#line 280 "runmath.in" addFunc(ve, run::gen_runmath36, primInt(), "NOT", formal(primInt(), "a", false, false)); -#line 283 "runmath.in" +#line 285 "runmath.in" addFunc(ve, run::gen_runmath37, primInt(), "CLZ", formal(primInt(), "a", false, false)); -#line 305 "runmath.in" +#line 307 "runmath.in" addFunc(ve, run::gen_runmath38, primInt(), "CTZ", formal(primInt(), "a", false, false)); } diff --git a/Build/source/utils/asymptote/runmath.in b/Build/source/utils/asymptote/runmath.in index 7b6e9e29579..d8f473a8433 100644 --- a/Build/source/utils/asymptote/runmath.in +++ b/Build/source/utils/asymptote/runmath.in @@ -89,18 +89,20 @@ Int sgn(real x) Int rand() { - return rand(); + return random(); } void srand(Int seed) { - srand(intcast(seed)); + const int n=256; + static char state[n]; + initstate(intcast(seed),state,n); } // a random number uniformly distributed in the interval [0,1] real unitrand() { - return ((real) rand())/RAND_MAX; + return ((real) random())/RAND_MAX; } Int ceil(real x) diff --git a/Build/source/utils/asymptote/runpair.cc b/Build/source/utils/asymptote/runpair.cc index c4e98e1b763..cd44539d9e3 100644 --- a/Build/source/utils/asymptote/runpair.cc +++ b/Build/source/utils/asymptote/runpair.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } @@ -380,7 +421,7 @@ void gen_runpair29(stack *Stack) pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); #line 203 "runpair.in" - {Stack->push<pair>(pair (z.getx()*w.getx(),z.gety()*w.gety())); return;} + {Stack->push<pair>(pair(z.getx()*w.getx(),z.gety()*w.gety())); return;} } // To avoid confusion, a dot product requires explicit pair arguments. diff --git a/Build/source/utils/asymptote/runpair.in b/Build/source/utils/asymptote/runpair.in index 43554902ed6..c7809a3558b 100644 --- a/Build/source/utils/asymptote/runpair.in +++ b/Build/source/utils/asymptote/runpair.in @@ -201,7 +201,7 @@ pair conj(pair z) pair realmult(pair z, pair w) { - return pair (z.getx()*w.getx(),z.gety()*w.gety()); + return pair(z.getx()*w.getx(),z.gety()*w.gety()); } // To avoid confusion, a dot product requires explicit pair arguments. diff --git a/Build/source/utils/asymptote/runpath.cc b/Build/source/utils/asymptote/runpath.cc index 22ed3438f32..3b672de21cc 100644 --- a/Build/source/utils/asymptote/runpath.cc +++ b/Build/source/utils/asymptote/runpath.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runpath3d.cc b/Build/source/utils/asymptote/runpath3d.cc index 671b3e67019..25233ab4a28 100644 --- a/Build/source/utils/asymptote/runpath3d.cc +++ b/Build/source/utils/asymptote/runpath3d.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } @@ -478,7 +519,8 @@ void gen_runpath3d30(stack *Stack) triplearray2 * P=vm::pop<triplearray2 *>(Stack); path3 p=vm::pop<path3>(Stack); #line 266 "runpath3d.in" - triple *A=copyTripleArray2C(P,true,4); + triple *A; + copyArray2C(A,P,true,4); if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), norm(A,16)); std::vector<real> T,U,V; @@ -496,49 +538,49 @@ void gen_runpath3d30(stack *Stack) {Stack->push<realarray2*>(W); return;} // Sorting will done in asy. } -#line 285 "runpath3d.in" +#line 286 "runpath3d.in" // Int size(path3 p); void gen_runpath3d31(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 286 "runpath3d.in" +#line 287 "runpath3d.in" {Stack->push<Int>(p.size()); return;} } -#line 290 "runpath3d.in" +#line 291 "runpath3d.in" // path3 &(path3 p, path3 q); void gen_runpath3d32(stack *Stack) { path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 291 "runpath3d.in" +#line 292 "runpath3d.in" {Stack->push<path3>(camp::concat(p,q)); return;} } -#line 295 "runpath3d.in" +#line 296 "runpath3d.in" // triple min(path3 p); void gen_runpath3d33(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 296 "runpath3d.in" +#line 297 "runpath3d.in" {Stack->push<triple>(p.min()); return;} } -#line 300 "runpath3d.in" +#line 301 "runpath3d.in" // triple max(path3 p); void gen_runpath3d34(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 301 "runpath3d.in" +#line 302 "runpath3d.in" {Stack->push<triple>(p.max()); return;} } -#line 305 "runpath3d.in" +#line 306 "runpath3d.in" // realarray* mintimes(path3 p); void gen_runpath3d35(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 306 "runpath3d.in" +#line 307 "runpath3d.in" array *V=new array(3); triple v=p.mintimes(); (*V)[0]=v.getx(); @@ -547,12 +589,12 @@ void gen_runpath3d35(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 315 "runpath3d.in" +#line 316 "runpath3d.in" // realarray* maxtimes(path3 p); void gen_runpath3d36(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 316 "runpath3d.in" +#line 317 "runpath3d.in" array *V=new array(3); triple v=p.maxtimes(); (*V)[0]=v.getx(); @@ -561,31 +603,31 @@ void gen_runpath3d36(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 325 "runpath3d.in" +#line 326 "runpath3d.in" // path3 *(realarray2 *t, path3 g); void gen_runpath3d37(stack *Stack) { path3 g=vm::pop<path3>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 326 "runpath3d.in" +#line 327 "runpath3d.in" {Stack->push<path3>(transformed(*t,g)); return;} } -#line 330 "runpath3d.in" +#line 331 "runpath3d.in" // pair minratio(path3 g); void gen_runpath3d38(stack *Stack) { path3 g=vm::pop<path3>(Stack); -#line 331 "runpath3d.in" +#line 332 "runpath3d.in" {Stack->push<pair>(g.ratio(::min)); return;} } -#line 335 "runpath3d.in" +#line 336 "runpath3d.in" // pair maxratio(path3 g); void gen_runpath3d39(stack *Stack) { path3 g=vm::pop<path3>(Stack); -#line 336 "runpath3d.in" +#line 337 "runpath3d.in" {Stack->push<pair>(g.ratio(::max)); return;} } @@ -657,23 +699,23 @@ void gen_runpath3d_venv(venv &ve) addFunc(ve, run::gen_runpath3d29, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); #line 265 "runpath3d.in" addFunc(ve, run::gen_runpath3d30, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false)); -#line 285 "runpath3d.in" +#line 286 "runpath3d.in" addFunc(ve, run::gen_runpath3d31, primInt(), "size", formal(primPath3(), "p", false, false)); -#line 290 "runpath3d.in" +#line 291 "runpath3d.in" addFunc(ve, run::gen_runpath3d32, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false)); -#line 295 "runpath3d.in" +#line 296 "runpath3d.in" addFunc(ve, run::gen_runpath3d33, primTriple(), "min", formal(primPath3(), "p", false, false)); -#line 300 "runpath3d.in" +#line 301 "runpath3d.in" addFunc(ve, run::gen_runpath3d34, primTriple(), "max", formal(primPath3(), "p", false, false)); -#line 305 "runpath3d.in" +#line 306 "runpath3d.in" addFunc(ve, run::gen_runpath3d35, realArray(), "mintimes", formal(primPath3(), "p", false, false)); -#line 315 "runpath3d.in" +#line 316 "runpath3d.in" addFunc(ve, run::gen_runpath3d36, realArray(), "maxtimes", formal(primPath3(), "p", false, false)); -#line 325 "runpath3d.in" +#line 326 "runpath3d.in" addFunc(ve, run::gen_runpath3d37, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false)); -#line 330 "runpath3d.in" +#line 331 "runpath3d.in" addFunc(ve, run::gen_runpath3d38, primPair(), "minratio", formal(primPath3(), "g", false, false)); -#line 335 "runpath3d.in" +#line 336 "runpath3d.in" addFunc(ve, run::gen_runpath3d39, primPair(), "maxratio", formal(primPath3(), "g", false, false)); } diff --git a/Build/source/utils/asymptote/runpath3d.in b/Build/source/utils/asymptote/runpath3d.in index 9f95c58cc7d..f4e355d838f 100644 --- a/Build/source/utils/asymptote/runpath3d.in +++ b/Build/source/utils/asymptote/runpath3d.in @@ -264,7 +264,8 @@ realarray2* intersections(path3 p, path3 q, real fuzz=-1) realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1) { - triple *A=copyTripleArray2C(P,true,4); + triple *A; + copyArray2C(A,P,true,4); if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), norm(A,16)); std::vector<real> T,U,V; diff --git a/Build/source/utils/asymptote/runpicture.cc b/Build/source/utils/asymptote/runpicture.cc index 5998d6ec4fd..3f3f2b9c51e 100644 --- a/Build/source/utils/asymptote/runpicture.cc +++ b/Build/source/utils/asymptote/runpicture.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } @@ -699,13 +740,15 @@ void gen_runpicture40(stack *Stack) checkEqual(n,checkArray(ambient)); checkEqual(n,checkArray(specular)); - real *T=copyArray2C(t,true,4); - real* Background=copyArrayC(background); - - triple *Lights=copyTripleArrayC(lights); - real *Diffuse=copyArray2C(diffuse,false,4,UseGC); - real *Ambient=copyArray2C(ambient,false,4,UseGC); - real *Specular=copyArray2C(specular,false,4,UseGC); + real *T,*Background,*Diffuse,*Ambient,*Specular; + triple *Lights; + + copyArray2C(T,t,true,4); + copyArrayC(Background,background); + copyArrayC(Lights,lights); + copyArray2C(Diffuse,diffuse,false,4,UseGC); + copyArray2C(Ambient,ambient,false,4,UseGC); + copyArray2C(Specular,specular,false,4,UseGC); f->shipout3(prefix,format,width,height,angle,zoom,m,M,shift,T,Background,n, Lights,Diffuse,Ambient,Specular,viewportlighting,view); @@ -714,7 +757,7 @@ void gen_runpicture40(stack *Stack) delete[] T; } -#line 430 "runpicture.in" +#line 432 "runpicture.in" // void shipout3(string prefix, picture *f, Intarray *index, triplearray *center); void gen_runpicture41(stack *Stack) { @@ -722,11 +765,11 @@ void gen_runpicture41(stack *Stack) Intarray * index=vm::pop<Intarray *>(Stack); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 431 "runpicture.in" +#line 433 "runpicture.in" f->shipout3(prefix,index,center); } -#line 435 "runpicture.in" +#line 437 "runpicture.in" // void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, callableTransform *xform); void gen_runpicture42(stack *Stack) { @@ -734,7 +777,7 @@ void gen_runpicture42(stack *Stack) real magnification=vm::pop<real>(Stack,1); picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); -#line 437 "runpicture.in" +#line 439 "runpicture.in" unsigned level=0; unsigned n=0; @@ -859,7 +902,7 @@ void gen_runpicture42(stack *Stack) // Three-dimensional picture and surface operations // Bezier curve -#line 562 "runpicture.in" +#line 564 "runpicture.in" // void _draw(picture *f, path3 g, pen p, string name=emptystring); void gen_runpicture43(stack *Stack) { @@ -867,13 +910,13 @@ void gen_runpicture43(stack *Stack) pen p=vm::pop<pen>(Stack); path3 g=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 563 "runpicture.in" +#line 565 "runpicture.in" if(g.size() > 0) f->append(new drawPath3(g,p,name)); } // Bezier patch -#line 569 "runpicture.in" +#line 571 "runpicture.in" // void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, real granularity, triple normal, penarray *colors, bool lighton, string name=emptystring, Int interaction); void gen_runpicture44(stack *Stack) { @@ -891,14 +934,14 @@ void gen_runpicture44(stack *Stack) triple center=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 573 "runpicture.in" +#line 575 "runpicture.in" f->append(new drawSurface(*P,center,straight,*p,opacity,shininess, PRCshininess,granularity,normal,*colors,lighton, name,interaction)); } // General NURBS curve -#line 580 "runpicture.in" +#line 582 "runpicture.in" // void draw(picture *f, triplearray *P, realarray *knot, realarray *weights=emptyarray, pen p, string name=emptystring); void gen_runpicture45(stack *Stack) { @@ -908,12 +951,12 @@ void gen_runpicture45(stack *Stack) realarray * knot=vm::pop<realarray *>(Stack); triplearray * P=vm::pop<triplearray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 582 "runpicture.in" +#line 584 "runpicture.in" f->append(new drawNurbsPath3(*P,knot,weights,p,name)); } // General NURBS surface -#line 587 "runpicture.in" +#line 589 "runpicture.in" // void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, real opacity, real shininess, real PRCshininess, real granularity, penarray *colors, bool lighton, string name=emptystring); void gen_runpicture46(stack *Stack) { @@ -930,63 +973,63 @@ void gen_runpicture46(stack *Stack) realarray * uknot=vm::pop<realarray *>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 591 "runpicture.in" +#line 593 "runpicture.in" f->append(new drawNurbs(*P,uknot,vknot,weights,*p,opacity,shininess, PRCshininess,granularity,*colors,lighton,name)); } -#line 596 "runpicture.in" +#line 598 "runpicture.in" // triple min3(picture *f); void gen_runpicture47(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 597 "runpicture.in" +#line 599 "runpicture.in" {Stack->push<triple>(f->bounds3().Min()); return;} } -#line 601 "runpicture.in" +#line 603 "runpicture.in" // triple max3(picture *f); void gen_runpicture48(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 602 "runpicture.in" +#line 604 "runpicture.in" {Stack->push<triple>(f->bounds3().Max()); return;} } -#line 606 "runpicture.in" +#line 608 "runpicture.in" // triple size3(picture *f); void gen_runpicture49(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 607 "runpicture.in" +#line 609 "runpicture.in" bbox3 b=f->bounds3(); {Stack->push<triple>(b.Max()-b.Min()); return;} } -#line 612 "runpicture.in" +#line 614 "runpicture.in" // pair minratio(picture *f); void gen_runpicture50(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 613 "runpicture.in" +#line 615 "runpicture.in" {Stack->push<pair>(f->ratio(::min)); return;} } -#line 617 "runpicture.in" +#line 619 "runpicture.in" // pair maxratio(picture *f); void gen_runpicture51(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 618 "runpicture.in" +#line 620 "runpicture.in" {Stack->push<pair>(f->ratio(::max)); return;} } -#line 622 "runpicture.in" +#line 624 "runpicture.in" // bool is3D(picture *f); void gen_runpicture52(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 623 "runpicture.in" +#line 625 "runpicture.in" {Stack->push<bool>(f->have3D()); return;} } @@ -1078,29 +1121,29 @@ void gen_runpicture_venv(venv &ve) addFunc(ve, run::gen_runpicture39, primVoid(), "shipout", formal(primString() , "prefix", true, false), formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primString() , "format", true, false), formal(primBoolean(), "wait", true, false), formal(primBoolean(), "view", true, false), formal(transformFunction(), "xform", false, false)); #line 404 "runpicture.in" addFunc(ve, run::gen_runpicture40, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(primString() , "format", true, false), formal(primReal(), "width", false, false), formal(primReal(), "height", false, false), formal(primReal(), "angle", false, false), formal(primReal(), "zoom", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(primPair(), "shift", false, false), formal(realArray2(), "t", false, false), formal(realArray(), "background", false, false), formal(tripleArray(), "lights", false, false), formal(realArray2(), "diffuse", false, false), formal(realArray2(), "ambient", false, false), formal(realArray2(), "specular", false, false), formal(primBoolean(), "viewportlighting", false, false), formal(primBoolean(), "view", true, false)); -#line 430 "runpicture.in" +#line 432 "runpicture.in" addFunc(ve, run::gen_runpicture41, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(IntArray(), "index", false, false), formal(tripleArray(), "center", false, false)); -#line 435 "runpicture.in" +#line 437 "runpicture.in" addFunc(ve, run::gen_runpicture42, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false)); -#line 558 "runpicture.in" +#line 560 "runpicture.in" addFunc(ve, run::gen_runpicture43, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false), formal(primString() , "name", true, false)); -#line 568 "runpicture.in" +#line 570 "runpicture.in" addFunc(ve, run::gen_runpicture44, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(primTriple(), "center", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false), formal(primInt(), "interaction", false, false)); -#line 579 "runpicture.in" +#line 581 "runpicture.in" addFunc(ve, run::gen_runpicture45, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray(), "p", false, false), formal(realArray(), "knot", false, false), formal(realArray(), "weights", true, false), formal(primPen(), "p", false, false), formal(primString() , "name", true, false)); -#line 586 "runpicture.in" +#line 588 "runpicture.in" addFunc(ve, run::gen_runpicture46, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(realArray(), "uknot", false, false), formal(realArray(), "vknot", false, false), formal(realArray2(), "weights", true, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false)); -#line 596 "runpicture.in" +#line 598 "runpicture.in" addFunc(ve, run::gen_runpicture47, primTriple(), "min3", formal(primPicture(), "f", false, false)); -#line 601 "runpicture.in" +#line 603 "runpicture.in" addFunc(ve, run::gen_runpicture48, primTriple(), "max3", formal(primPicture(), "f", false, false)); -#line 606 "runpicture.in" +#line 608 "runpicture.in" addFunc(ve, run::gen_runpicture49, primTriple(), "size3", formal(primPicture(), "f", false, false)); -#line 612 "runpicture.in" +#line 614 "runpicture.in" addFunc(ve, run::gen_runpicture50, primPair(), "minratio", formal(primPicture(), "f", false, false)); -#line 617 "runpicture.in" +#line 619 "runpicture.in" addFunc(ve, run::gen_runpicture51, primPair(), "maxratio", formal(primPicture(), "f", false, false)); -#line 622 "runpicture.in" +#line 624 "runpicture.in" addFunc(ve, run::gen_runpicture52, primBoolean(), "is3D", formal(primPicture(), "f", false, false)); } diff --git a/Build/source/utils/asymptote/runpicture.in b/Build/source/utils/asymptote/runpicture.in index 232c4229a17..d5a7b32b618 100644 --- a/Build/source/utils/asymptote/runpicture.in +++ b/Build/source/utils/asymptote/runpicture.in @@ -412,13 +412,15 @@ void shipout3(string prefix, picture *f, string format=emptystring, checkEqual(n,checkArray(ambient)); checkEqual(n,checkArray(specular)); - real *T=copyArray2C(t,true,4); - real* Background=copyArrayC(background); - - triple *Lights=copyTripleArrayC(lights); - real *Diffuse=copyArray2C(diffuse,false,4,UseGC); - real *Ambient=copyArray2C(ambient,false,4,UseGC); - real *Specular=copyArray2C(specular,false,4,UseGC); + real *T,*Background,*Diffuse,*Ambient,*Specular; + triple *Lights; + + copyArray2C(T,t,true,4); + copyArrayC(Background,background); + copyArrayC(Lights,lights); + copyArray2C(Diffuse,diffuse,false,4,UseGC); + copyArray2C(Ambient,ambient,false,4,UseGC); + copyArray2C(Specular,specular,false,4,UseGC); f->shipout3(prefix,format,width,height,angle,zoom,m,M,shift,T,Background,n, Lights,Diffuse,Ambient,Specular,viewportlighting,view); diff --git a/Build/source/utils/asymptote/runstring.cc b/Build/source/utils/asymptote/runstring.cc index a7b7fed8c0d..91b58a9719a 100644 --- a/Build/source/utils/asymptote/runstring.cc +++ b/Build/source/utils/asymptote/runstring.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runsystem.cc b/Build/source/utils/asymptote/runsystem.cc index c9ae144bee2..b1924985222 100644 --- a/Build/source/utils/asymptote/runsystem.cc +++ b/Build/source/utils/asymptote/runsystem.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc index 96889380400..e71e6b0e3d1 100644 --- a/Build/source/utils/asymptote/runtime.cc +++ b/Build/source/utils/asymptote/runtime.cc @@ -43,6 +43,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -61,12 +62,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runtimebase.in b/Build/source/utils/asymptote/runtimebase.in index 779c87ae8e5..bce2fb0dad7 100644 --- a/Build/source/utils/asymptote/runtimebase.in +++ b/Build/source/utils/asymptote/runtimebase.in @@ -32,6 +32,7 @@ string => primString() using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -50,12 +51,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/runtriple.cc b/Build/source/utils/asymptote/runtriple.cc index da4812d9beb..a240339c211 100644 --- a/Build/source/utils/asymptote/runtriple.cc +++ b/Build/source/utils/asymptote/runtriple.cc @@ -31,6 +31,7 @@ using vm::stack; using vm::error; using vm::array; +using vm::read; using vm::callable; using types::formal; using types::function; @@ -49,12 +50,52 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0, - GCPlacement placement=NoGC); +inline size_t checkdimension(const array *a, size_t dim) +{ + size_t size=checkArray(a); + if(dim && size != dim) { + ostringstream buf; + buf << "array of length " << dim << " expected"; + error(buf); + } + return size; +} + +template<class T> +void copyArrayC(T* &dest, const array *a, size_t dim=0, + GCPlacement placement=NoGC) +{ + size_t size=checkdimension(a,dim); + dest=(placement == NoGC) ? new T[size] : new(placement) T[size]; + for(size_t i=0; i < size; i++) + dest[i]=read<T>(a,i); +} + +template<class T> +void copyArray2C(T* &dest, const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2; + error(buf); + } + + dest=(placement == NoGC) ? new T[n*m] : new(placement) T[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + T *desti=dest+i*m; + for(size_t j=0; j < m; j++) + desti[j]=read<T>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } +} -triple *copyTripleArrayC(const array *a, size_t dim=0); -triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, GCPlacement placement=NoGC); } diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc index 7197095f304..4ea29ebabe5 100644 --- a/Build/source/utils/asymptote/settings.cc +++ b/Build/source/utils/asymptote/settings.cc @@ -87,6 +87,7 @@ string systemDir=ASYMPTOTE_SYSDIR; bool msdos=false; string HOME="HOME"; +string docdir=ASYMPTOTE_DOCDIR; const char pathSeparator=':'; string defaultPSViewer="gv"; #ifdef __APPLE__ @@ -97,7 +98,6 @@ string defaultPDFViewer="acroread"; string defaultGhostscript="gs"; string defaultDisplay="display"; string defaultAnimate="animate"; -string docdir=ASYMPTOTE_DOCDIR; void queryRegistry() {} const string dirsep="/"; @@ -105,6 +105,7 @@ const string dirsep="/"; bool msdos=true; string HOME="USERPROFILE"; +string docdir="c:\\Program Files\\Asymptote"; const char pathSeparator=';'; //string defaultPSViewer="gsview32.exe"; string defaultPSViewer="cmd"; @@ -115,7 +116,6 @@ string defaultGhostscript="gswin32c.exe"; string defaultDisplay="cmd"; //string defaultAnimate="animate"; string defaultAnimate="cmd"; -string docdir; const string dirsep="\\"; #include <dirent.h> @@ -187,7 +187,9 @@ void queryRegistry() defaultPDFViewer; if(defaultPSViewer != "cmd") defaultPSViewer=getEntry("Ghostgum/GSview/*")+"\\gsview\\"+defaultPSViewer; - docdir=getEntry("Microsoft/Windows/CurrentVersion/App Paths/Asymptote/Path"); + string s; + s=getEntry("Microsoft/Windows/CurrentVersion/App Paths/Asymptote/Path"); + if(!s.empty()) docdir=s; // An empty systemDir indicates a TeXLive build if(!systemDir.empty() && !docdir.empty()) systemDir=docdir; @@ -1594,6 +1596,9 @@ void setOptions(int argc, char *argv[]) Setting("sysdir")=sysdir; + if(docdir.empty()) + docdir=getSetting<string>("dir"); + #ifdef USEGC if(verbose == 0 && !getSetting<bool>("debug")) GC_set_warn_proc(no_GCwarn); #endif diff --git a/Build/source/utils/asymptote/triple.h b/Build/source/utils/asymptote/triple.h index a4b1b3739cf..fde711bb5e3 100644 --- a/Build/source/utils/asymptote/triple.h +++ b/Build/source/utils/asymptote/triple.h @@ -132,14 +132,14 @@ public: friend double dot(const triple& u, const triple& v) { - return u.getx()*v.getx()+u.gety()*v.gety()+u.getz()*v.getz(); + return u.x*v.x+u.y*v.y+u.z*v.z; } friend triple cross(const triple& u, const triple& v) { - return triple(u.gety()*v.getz()-u.getz()*v.gety(), - u.getz()*v.getx()-u.getx()*v.getz(), - u.getx()*v.gety()-v.getx()*u.gety()); + return triple(u.y*v.z-u.z*v.y, + u.z*v.x-u.x*v.z, + u.x*v.y-v.x*u.y); } // Returns a unit triple in the direction (theta,phi), in radians. diff --git a/Build/source/utils/asymptote/util.h b/Build/source/utils/asymptote/util.h index 73dc411b97d..3a0241e53c9 100644 --- a/Build/source/utils/asymptote/util.h +++ b/Build/source/utils/asymptote/util.h @@ -130,6 +130,8 @@ void popupHelp(); #ifdef __CYGWIN__ inline long long llabs(long long x) {return x >= 0 ? x : -x;} +extern "C" char *initstate (unsigned seed, char *state, size_t size); +extern "C" long random (void); #endif inline Int Abs(Int x) { |