From 8f83d317911551c7579ab2cb79fea839fa32c211 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 10:12:08 +0200 Subject: [PATCH 01/20] start upgrading to 1.33 --- src/ForwardModeAD.chpl | 2 -- src/differentiation.chpl | 4 ++-- src/dualtype.chpl | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ForwardModeAD.chpl b/src/ForwardModeAD.chpl index 6dac733..4eb63c5 100644 --- a/src/ForwardModeAD.chpl +++ b/src/ForwardModeAD.chpl @@ -1,7 +1,5 @@ module ForwardModeAD { - public use Math; - public use dualtype; public use arithmetic; diff --git a/src/differentiation.chpl b/src/differentiation.chpl index aa6d7e9..51f3651 100644 --- a/src/differentiation.chpl +++ b/src/differentiation.chpl @@ -15,7 +15,7 @@ module differentiation { return new dual(x, 1.0); } - pragma "no doc" + @chpldoc.nodoc proc initdual(x : [?D] ?t) { var x0 : [D] multidual; forall i in D { @@ -74,7 +74,7 @@ module differentiation { /* Extracts the derivative from a dual number. */ proc derivative(x: dual) {return dualPart(x);} - pragma "no doc" + @chpldoc.nodoc proc derivative(x: real) {return 0.0;} /* diff --git a/src/dualtype.chpl b/src/dualtype.chpl index fc8ce5e..a2c6f91 100644 --- a/src/dualtype.chpl +++ b/src/dualtype.chpl @@ -35,10 +35,10 @@ module dualtype { /* Converts a real number and array of reals to a multidual number. */ proc todual(val : real, grad : [?D]) {return new multidual(D, val, [g in grad] g : real);} - pragma "no doc" + @chpldoc.nodoc proc isDualType(type t : dual) param {return true;} - pragma "no doc" + @chpldoc.nodoc proc isDualType(type t : multidual) param {return true;} /* Returns ``true`` if ``t`` is ``dual`` or ``multidual``. */ @@ -69,10 +69,10 @@ module dualtype { return [ai in a] dualPart(ai); } - pragma "no doc" + @chpldoc.nodoc proc primalPart(a) {return a;} - pragma "no doc" + @chpldoc.nodoc proc dualPart(a) {return 0.0;} proc isclose(a, b, rtol=1e-5, atol=0.0) where isEitherDualType(a.type, b.type) { From 995514c31b870c840870b23375eeb4898ad02079 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 10:15:53 +0200 Subject: [PATCH 02/20] debugging info when running tests --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c89bbf8..5e8b561 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,7 +28,7 @@ jobs: # Runs a single command using the runners shell - name: Run tests run: | - mason test + mason test --show mac-test: runs-on: macos-latest steps: @@ -38,4 +38,4 @@ jobs: brew install chapel - name: Run test run: | - mason test + mason test --show From 5c3ce83e7b2e8a072b3b1240f5de5e02df5582c4 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 10:18:47 +0200 Subject: [PATCH 03/20] add .readthedocs.yaml --- .readthedocs.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..dd2aa46 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,35 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.12" + # You can also specify other tool versions: + # nodejs: "20" + # rust: "1.70" + # golang: "1.20" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/conf.py + # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs + # builder: "dirhtml" + # Fail on all warnings to avoid broken references + # fail_on_warning: true + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +# python: +# install: +# - requirements: docs/requirements.txt From a075322c58c8f3e49a7a539e0331b72cba79bc6f Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 10:23:32 +0200 Subject: [PATCH 04/20] update readthedocs yaml --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index dd2aa46..a83c2f3 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -16,7 +16,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: docs/source/conf.py # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs # builder: "dirhtml" # Fail on all warnings to avoid broken references From efe8ff65105cb7567f60de409e1abdc1ea3c0ddc Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 10:46:18 +0200 Subject: [PATCH 05/20] try fix the docs --- .readthedocs.yaml | 2 +- docs/{source => }/conf.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/{source => }/conf.py (100%) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index a83c2f3..dd2aa46 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -16,7 +16,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/source/conf.py + configuration: docs/conf.py # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs # builder: "dirhtml" # Fail on all warnings to avoid broken references diff --git a/docs/source/conf.py b/docs/conf.py similarity index 100% rename from docs/source/conf.py rename to docs/conf.py From f72166f96107ae839dcdce86fc902ff2a90a9f86 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 11:45:19 +0200 Subject: [PATCH 06/20] fix lambda deprecation --- test/test_differentiation.chpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_differentiation.chpl b/test/test_differentiation.chpl index 121bfd9..05ba8b3 100644 --- a/test/test_differentiation.chpl +++ b/test/test_differentiation.chpl @@ -9,7 +9,7 @@ proc testUnivariateFunctions(test: borrowed Test) throws { return x ** 2 + 2 * x + 1; } - var df = derivative(lambda(x : dual) {return f(x);}, 1); + var df = derivative(proc(x : dual) {return f(x);}, 1); test.assertEqual(df, 4.0); var valder = f(initdual(1)); @@ -22,7 +22,7 @@ proc testGradient(test: borrowed Test) throws { return 2.0; } - var dg = gradient(lambda(x : D) {return g(x);}, [1.0, 2.0]); + var dg = gradient(proc(x : D) {return g(x);}, [1.0, 2.0]); test.assertEqual(dg, [0.0, 0.0]); proc h(x) { @@ -47,7 +47,7 @@ proc testJacobian(test: borrowed Test) throws { proc G(x) {return [1, 2, 3];} - var Jg = jacobian(lambda(x : D) {return G(x);}, [1.0, 2.0]), + var Jg = jacobian(proc(x : D) {return G(x);}, [1.0, 2.0]), _Jg: [0..2, 0..1] real; test.assertEqual(Jg, _Jg); @@ -63,7 +63,7 @@ proc testDirectionalAndJvp(test: borrowed Test) throws { test.assertEqual(value(valdirder), 7); test.assertEqual(directionalDerivative(valdirder), 10); - var dirder = directionalDerivative(lambda(x: D2) {return f(x);}, [1, 2], [0.5, 2.0]); + var dirder = directionalDerivative(proc(x: D2) {return f(x);}, [1, 2], [0.5, 2.0]); test.assertEqual(dirder, 10); proc F(x) { @@ -74,7 +74,7 @@ proc testDirectionalAndJvp(test: borrowed Test) throws { test.assertEqual(value(valjvp), [4.0, 7.0]); test.assertEqual(jvp(valjvp), [3.0, 11.5]); - var Jv = jvp(lambda(x: D2) {return F(x);}, [1, 2], [0.5, 2.0]); + var Jv = jvp(proc(x: D2) {return F(x);}, [1, 2], [0.5, 2.0]); test.assertEqual(Jv, [3.0, 11.5]); } From a639ff1984a9adc44c550bd75ec0485af81bf4e1 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 11:49:27 +0200 Subject: [PATCH 07/20] install requirements --- .readthedocs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index dd2aa46..bff923c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -30,6 +30,6 @@ sphinx: # Optional but recommended, declare the Python requirements required # to build your documentation # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html -# python: -# install: -# - requirements: docs/requirements.txt +python: + install: + - requirements: docs/requirements.txt From db20e95a493dd489f2e5d8be1e6d94b1fbb93e88 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 12:19:03 +0200 Subject: [PATCH 08/20] try update sphinx --- docs/Makefile | 183 ++++++++++++++++++-- docs/make.bat | 277 +++++++++++++++++++++++++++---- docs/source/_static/empty | 1 + docs/source/_templates/empty | 1 + docs/source/_templates/page.html | 16 ++ 5 files changed, 430 insertions(+), 48 deletions(-) create mode 100644 docs/source/_static/empty create mode 100644 docs/source/_templates/empty create mode 100644 docs/source/_templates/page.html diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf..c0dc64b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,20 +1,177 @@ -# Minimal makefile for Sphinx documentation +# Makefile for Sphinx documentation # -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source +# You can set these variables from the command line. +SPHINXOPTS = -W +SPHINXBUILD = sphinx-build +PAPER = BUILDDIR = build -# Put it first so that "make" without argument is like "make help". +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/chpldoc.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/chpldoc.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/chpldoc" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/chpldoc" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." -.PHONY: help Makefile +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/make.bat b/docs/make.bat index 747ffb7..c551fd7 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,35 +1,242 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=build +set ALLSPHINXOPTS=-W -d %BUILDDIR%/doctrees %SPHINXOPTS% source +set I18NSPHINXOPTS=%SPHINXOPTS% source +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\chpldoc.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\chpldoc.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/docs/source/_static/empty b/docs/source/_static/empty new file mode 100644 index 0000000..4134791 --- /dev/null +++ b/docs/source/_static/empty @@ -0,0 +1 @@ +This directory is empty. diff --git a/docs/source/_templates/empty b/docs/source/_templates/empty new file mode 100644 index 0000000..4134791 --- /dev/null +++ b/docs/source/_templates/empty @@ -0,0 +1 @@ +This directory is empty. diff --git a/docs/source/_templates/page.html b/docs/source/_templates/page.html new file mode 100644 index 0000000..d604afd --- /dev/null +++ b/docs/source/_templates/page.html @@ -0,0 +1,16 @@ +{% extends "!page.html" %} +{% block footer %} +{{ super() }} +{% if theme_analytics_id %} + +{% endif %} +{% endblock %} From d2ba3653b27252eee044631c199729a98ba79bab Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 12:22:58 +0200 Subject: [PATCH 09/20] try now --- .readthedocs.yaml | 2 +- docs/conf.py | 60 ---------- docs/source/conf.py | 283 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 284 insertions(+), 61 deletions(-) delete mode 100644 docs/conf.py create mode 100644 docs/source/conf.py diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bff923c..fe73f99 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -16,7 +16,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: docs/source/conf.py # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs # builder: "dirhtml" # Fail on all warnings to avoid broken references diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 8753549..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,60 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'ForwardModeAD' -copyright = '2022, Luca Ferranti' -author = 'Luca Ferranti' - -# The full version, including alpha/beta/rc tags -release = '0.1.0' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinx.ext.mathjax', 'sphinxcontrib.chapeldomain'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = [] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -html_sidebars = { - '**': [ - 'globaltoc.html', - ] -} diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..62be6e0 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,283 @@ +# -*- coding: utf-8 -*- +# +# chpldoc documentation build configuration file, created by +# sphinx-quickstart on Thu Jan 29 08:44:44 2015. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.todo', + 'sphinxcontrib.chapeldomain', + 'sphinx.ext.mathjax', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'chpldoc' + +author_text = os.environ.get('CHPLDOC_AUTHOR', 'AUTHOR TEXT') + +if len(author_text): + copyright = u'2015, {0}'.format(author_text) +else: + copyright = u'2015' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = os.environ.get('CHPLDOC_PROJECT_VERSION', '').split("-")[0] +# version = '0.0.1-alpha' +# The full version, including alpha/beta/rc tags. +release = os.environ.get('CHPLDOC_PROJECT_VERSION', '') + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +if not on_rtd: + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + + html_theme_options = { + 'sticky_navigation': True, + } + + analytics_id = os.environ.get('CHPLDOC_ANALYTICS_ID') + if analytics_id: + html_theme_options['analytics_id'] = analytics_id + + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'chpldocdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'chpldoc.tex', u'chpldoc Documentation', + author_text, 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'chpldoc', u'chpldoc Documentation', + [author_text], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'chpldoc', u'chpldoc Documentation', + author_text, 'chpldoc', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False From 83d28a3a61c32d656b18b0606d876ef3774e17ba Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 12:33:55 +0200 Subject: [PATCH 10/20] update conf file --- docs/source/conf.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 62be6e0..17402ef 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -49,24 +49,16 @@ master_doc = 'index' # General information about the project. -project = u'chpldoc' +project = 'ForwardModeAD' +copyright = '2022 - 2024 Luca Ferranti' +author = 'Luca Ferranti' -author_text = os.environ.get('CHPLDOC_AUTHOR', 'AUTHOR TEXT') - -if len(author_text): - copyright = u'2015, {0}'.format(author_text) -else: - copyright = u'2015' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = os.environ.get('CHPLDOC_PROJECT_VERSION', '').split("-")[0] -# version = '0.0.1-alpha' -# The full version, including alpha/beta/rc tags. -release = os.environ.get('CHPLDOC_PROJECT_VERSION', '') +release = '0.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -111,6 +103,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. +html_theme = 'sphinx_rtd_theme' if not on_rtd: import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' @@ -168,7 +161,11 @@ #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +html_sidebars = { + '**': [ + 'globaltoc.html', + ] +} # Additional templates that should be rendered to pages, maps page names to # template names. From f448384020c4519e73137144fadcbcf6f5dfd10a Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 12:35:45 +0200 Subject: [PATCH 11/20] add author text field --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 17402ef..3fbe5f1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -51,7 +51,7 @@ # General information about the project. project = 'ForwardModeAD' copyright = '2022 - 2024 Luca Ferranti' -author = 'Luca Ferranti' +author_text = 'Luca Ferranti' # The version info for the project you're documenting, acts as replacement for From eb1d9db119d466505a46833e2be7277d03dbb962 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Wed, 28 Feb 2024 12:38:28 +0200 Subject: [PATCH 12/20] try add theme to requirements --- docs/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 2444e5a..252f32e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,2 @@ -sphinxcontrib-chapeldomain \ No newline at end of file +sphinxcontrib-chapeldomain +sphinx_rtd_theme From b40e04b3094ec7acf98d2ee3100f9b03d659669a Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Sat, 2 Mar 2024 00:04:59 +0200 Subject: [PATCH 13/20] fixes for 2.0 --- Mason.toml | 4 ++-- src/ForwardModeAD.chpl | 2 ++ src/transcendental.chpl | 8 ++++---- test/test_dual_algebra.chpl | 12 ++++++------ test/test_multidual_algebra.chpl | 10 +++++----- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Mason.toml b/Mason.toml index e773edc..9ec57d8 100644 --- a/Mason.toml +++ b/Mason.toml @@ -1,10 +1,10 @@ [brick] authors = "Luca Ferranti" -chplVersion = "1.28.0" +chplVersion = "2.0.0" license = "MIT" name = "ForwardModeAD" -version = "0.1.0" +version = "0.2.0" type="library" [dependencies] diff --git a/src/ForwardModeAD.chpl b/src/ForwardModeAD.chpl index 4eb63c5..6dac733 100644 --- a/src/ForwardModeAD.chpl +++ b/src/ForwardModeAD.chpl @@ -1,5 +1,7 @@ module ForwardModeAD { + public use Math; + public use dualtype; public use arithmetic; diff --git a/src/transcendental.chpl b/src/transcendental.chpl index 9e19132..36d2941 100644 --- a/src/transcendental.chpl +++ b/src/transcendental.chpl @@ -22,7 +22,7 @@ module transcendental { proc exp2(a) where isDualType(a.type) { var f = exp2(primalPart(a)), - df = ln_2 * exp2(primalPart(a)) * dualPart(a); + df = ln2 * exp2(primalPart(a)) * dualPart(a); return todual(f, df); } @@ -40,13 +40,13 @@ module transcendental { proc log2(a) where isDualType(a.type) { var f = log2(primalPart(a)), - df = dualPart(a)/(primalPart(a) * ln_2); + df = dualPart(a)/(primalPart(a) * ln2); return todual(f, df); } proc log10(a) where isDualType(a.type) { var f = log10(primalPart(a)), - df = dualPart(a) / (primalPart(a) * ln_10); + df = dualPart(a) / (primalPart(a) * ln10); return todual(f, df); } @@ -55,4 +55,4 @@ module transcendental { df = dualPart(a) / (primalPart(a) + 1); return todual(f, df); } -} \ No newline at end of file +} diff --git a/test/test_dual_algebra.chpl b/test/test_dual_algebra.chpl index 321cb1b..9b5e397 100644 --- a/test/test_dual_algebra.chpl +++ b/test/test_dual_algebra.chpl @@ -38,7 +38,7 @@ proc test_arithmetic_operations(test : borrowed Test) throws { proc test_trigonometric_operations(test : borrowed Test) throws { var x = new dual(pi, 1); - var y = new dual(half_pi, 1); + var y = new dual(halfPi, 1); var z = new dual(sqrt(2) / 2.0, 2); // TODO: use isclose with e.g. atol=1e-10 and rtol=1e-5 @@ -55,19 +55,19 @@ proc test_trigonometric_operations(test : borrowed Test) throws { proc test_transcendental_functions(test : borrowed Test) throws { var x = new dual(2, 3); - test.assertEqual(2 ** x, new dual(4, 12 * ln_2)); + test.assertEqual(2 ** x, new dual(4, 12 * ln2)); - test.assertEqual(x ** x, new dual(4, 12 * (ln_2 + 1))); + test.assertEqual(x ** x, new dual(4, 12 * (ln2 + 1))); test.assertEqual(exp(x), new dual(exp(2), 3 * exp(2))); - test.assertEqual(exp2(x), new dual(4, 12 * ln_2)); + test.assertEqual(exp2(x), new dual(4, 12 * ln2)); test.assertEqual(expm1(x), new dual(expm1(2), 3 * exp(2))); - test.assertEqual(log(x), new dual(ln_2, 1.5)); + test.assertEqual(log(x), new dual(ln2, 1.5)); - test.assertEqual(log2(x), new dual(1, 1.5 / ln_2)); + test.assertEqual(log2(x), new dual(1, 1.5 / ln2)); test.assertEqual(log1p(x), new dual(log1p(2), 1)); } diff --git a/test/test_multidual_algebra.chpl b/test/test_multidual_algebra.chpl index 3e7bef4..8fafba9 100644 --- a/test/test_multidual_algebra.chpl +++ b/test/test_multidual_algebra.chpl @@ -51,19 +51,19 @@ proc test_trigonometric_operations(test : borrowed Test) throws { proc test_transcendental_functions(test : borrowed Test) throws { var x = todual(2, [2, 3]); - test.assertEqual(2 ** x, todual(4, [8 * ln_2, 12 * ln_2])); + test.assertEqual(2 ** x, todual(4, [8 * ln2, 12 * ln2])); - test.assertEqual(x ** x, todual(4, [8 * (ln_2 + 1), 12 * (ln_2 + 1)])); + test.assertEqual(x ** x, todual(4, [8 * (ln2 + 1), 12 * (ln2 + 1)])); test.assertEqual(exp(x), todual(exp(2), [2 * exp(2), 3 * exp(2)])); - test.assertEqual(exp2(x), todual(4, [8 * ln_2, 12 * ln_2])); + test.assertEqual(exp2(x), todual(4, [8 * ln2, 12 * ln2])); test.assertEqual(expm1(x), todual(expm1(2), [2 * exp(2), 3 * exp(2)])); - test.assertEqual(log(x), todual(ln_2, [1.0, 1.5])); + test.assertEqual(log(x), todual(ln2, [1.0, 1.5])); - test.assertEqual(log2(x), todual(1, [1.0 / ln_2, 1.5 / ln_2])); + test.assertEqual(log2(x), todual(1, [1.0 / ln2, 1.5 / ln2])); test.assertEqual(log1p(x), todual(log1p(2), [2.0 / 3.0, 1.0])); } From 289ee56015f124c1b9c8531ccf96c0398e4f01d8 Mon Sep 17 00:00:00 2001 From: Luca Ferranti <49938764+lucaferranti@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:13:56 +0200 Subject: [PATCH 14/20] try updating CI --- .github/workflows/CI.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5e8b561..6af2ebd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,9 +15,15 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - linux-test: + test: + name: Test on $${{ matrix.os }} # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest container: image: chapel/chapel # Steps represent a sequence of tasks that will be executed as part of the job @@ -28,14 +34,4 @@ jobs: # Runs a single command using the runners shell - name: Run tests run: | - mason test --show - mac-test: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - run: | - brew install chapel - - name: Run test - run: | - mason test --show + mason test --show \ No newline at end of file From fede799de814717aefb7b3d906a4d5f8efe3dd44 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Thu, 21 Mar 2024 22:37:41 +0200 Subject: [PATCH 15/20] Revert "try updating CI" This reverts commit 289ee56015f124c1b9c8531ccf96c0398e4f01d8. --- .github/workflows/CI.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6af2ebd..5e8b561 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,15 +15,9 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - test: - name: Test on $${{ matrix.os }} + linux-test: # The type of runner that the job will run on - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest + runs-on: ubuntu-latest container: image: chapel/chapel # Steps represent a sequence of tasks that will be executed as part of the job @@ -34,4 +28,14 @@ jobs: # Runs a single command using the runners shell - name: Run tests run: | - mason test --show \ No newline at end of file + mason test --show + mac-test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: | + brew install chapel + - name: Run test + run: | + mason test --show From ae58833ed5274585827468e3137a97ba1c8ebb94 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Thu, 21 Mar 2024 22:49:10 +0200 Subject: [PATCH 16/20] try fix version for brew --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5e8b561..ec585f3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | - brew install chapel + brew install chapel@2 - name: Run test run: | mason test --show From 493ed260de9dc667ad720fae46e110d64e782f5f Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Fri, 22 Mar 2024 00:08:51 +0200 Subject: [PATCH 17/20] debug statement for brew --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ec585f3..4d3a5f5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,6 +35,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | + cd $(brew --repository homebrew/core) && git remote -v && cd - brew install chapel@2 - name: Run test run: | From 24d9641e413cac5862499a055e460ff87d38b6db Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Fri, 22 Mar 2024 00:10:08 +0200 Subject: [PATCH 18/20] hups --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4d3a5f5..cb42add 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -36,7 +36,7 @@ jobs: - name: Install dependencies run: | cd $(brew --repository homebrew/core) && git remote -v && cd - - brew install chapel@2 + brew install chapel - name: Run test run: | mason test --show From 50eefe8ce7fcb84f676ab1d78ad40e7f21b9d4c9 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Fri, 22 Mar 2024 00:15:56 +0200 Subject: [PATCH 19/20] what about now? --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cb42add..17aa337 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | - cd $(brew --repository homebrew/core) && git remote -v && cd - + brew update brew install chapel - name: Run test run: | From 9d5daee5230194eb693235b34ba032165bdbf2ae Mon Sep 17 00:00:00 2001 From: Luca Ferranti <49938764+lucaferranti@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:21:27 +0200 Subject: [PATCH 20/20] Update .github/workflows/CI.yml --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 17aa337..5e8b561 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,6 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | - brew update brew install chapel - name: Run test run: |