From 568a1867a8639f1c5f6f909c1d9c337cddbb2ef1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 01:32:03 +0000 Subject: [PATCH 01/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1d6c47d..2ed429e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.0", "@stdlib/math-base-napi-binary": "^0.2.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.1" + "@stdlib/utils-library-manifest": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.1", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1692ca64dcc34b76012bcfd8d807b7365106d049 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 01:42:26 +0000 Subject: [PATCH 02/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 48 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 60 files changed, 4872 insertions(+), 5593 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f92a6c5..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/math/base/ops/cmul]: https://github.com/stdlib-js/math-base-ops-cmul +[@stdlib/math/base/ops/cmul]: https://github.com/stdlib-js/math-base-ops-cmul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index 9ad2899..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random double on the interval [0,1]. -* -* @return random double -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 0952471..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..e36b970 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.0-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 2ed429e..6489a82 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.0.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.1", - "@stdlib/complex-float64-imag": "^0.1.0", - "@stdlib/complex-float64-real": "^0.1.0", - "@stdlib/complex-float64-reim": "^0.1.0", - "@stdlib/math-base-napi-binary": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6277453 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From a5c0c65554f7c605ff2fdf072a258da82c583f83 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 03:42:35 +0000 Subject: [PATCH 03/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1d6c47d..2ed429e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.0", "@stdlib/math-base-napi-binary": "^0.2.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.1" + "@stdlib/utils-library-manifest": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.1", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 32360c0e70ab7752b58d2a0b82265d061a765b71 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 03:46:56 +0000 Subject: [PATCH 04/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index e36b970..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.0-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6277453..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1e8088ad1941b8cb59e9f693b4a40ce50ddbc080 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 03:47:11 +0000 Subject: [PATCH 05/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 50 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 60 files changed, 4872 insertions(+), 5595 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f92a6c5..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index 9ad2899..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random double on the interval [0,1]. -* -* @return random double -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 0952471..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..e36b970 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.0-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 2ed429e..6489a82 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.0.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.1", - "@stdlib/complex-float64-imag": "^0.1.0", - "@stdlib/complex-float64-real": "^0.1.0", - "@stdlib/complex-float64-reim": "^0.1.0", - "@stdlib/math-base-napi-binary": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6277453 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From 67a869ff36b0e0977a2edb95f72534a71b70cf02 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 03:52:26 +0000 Subject: [PATCH 06/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index de06347..c1ab5d9 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.2.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ee4bd522854d347faae861f1b5374a2154dd9a11 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 04:12:44 +0000 Subject: [PATCH 07/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index e36b970..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.0-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6277453..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2307248783aaae6439f966c9650d57e1c2541533 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 04:13:01 +0000 Subject: [PATCH 08/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 60 files changed, 4872 insertions(+), 5596 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index c1ab5d9..6489a82 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.0.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From 52dbf120cffcdbcfb872998ce62a40c915e732ec Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 20:28:00 +0000 Subject: [PATCH 09/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e422d67..e47505f 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 66245450c58b8634b6c870adeeaf7ddc7ad8b7cc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 20:33:58 +0000 Subject: [PATCH 10/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ca44f3a08f4ecd405a254090e38b0284e393594e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 20:34:15 +0000 Subject: [PATCH 11/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 60 files changed, 4872 insertions(+), 5596 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index e47505f..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From 49a51965c9935d27867972861079776535f110ae Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 20:34:41 +0000 Subject: [PATCH 12/67] Update README.md for ESM bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 08ddec3..682c9a0 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ limitations under the License. ## Usage ```javascript -import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@esm/index.mjs'; +import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@v0.1.0-esm/index.mjs'; ``` #### add( z1, z2 ) @@ -90,7 +90,7 @@ var im = imag( v ); import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-discrete-uniform' ).factory; -import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@esm/index.mjs'; +import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@v0.1.0-esm/index.mjs'; var rand = discreteUniform( -50, 50 ); From 19c32db3c2d22b880821519b89acae193c7f5a29 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 20:34:42 +0000 Subject: [PATCH 13/67] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 682c9a0..388182b 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/complex-float64-base-add/tags). For example, + ```javascript import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@v0.1.0-esm/index.mjs'; ``` @@ -90,7 +95,7 @@ var im = imag( v ); import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-discrete-uniform' ).factory; -import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@v0.1.0-esm/index.mjs'; +import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-base-add@esm/index.mjs'; var rand = discreteUniform( -50, 50 ); From f3285695cc9c7445658bb9906eb2722187c11e44 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 06:35:27 +0000 Subject: [PATCH 14/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e422d67..e47505f 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 99f0afc0dd1c69e897d2e7aafec0e754c0aa5bf9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:16:25 +0000 Subject: [PATCH 15/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d09570c57d0d42df2183e40f9a91cf882fdde0d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:16:42 +0000 Subject: [PATCH 16/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 48 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 61 files changed, 4872 insertions(+), 5596 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 388e4ce..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T04:45:26.458Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index e47505f..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From c290c11d308aeed0490b97ec3e45ccd75aadd768 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 21:49:02 +0000 Subject: [PATCH 17/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e422d67..e47505f 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 5ed29122d9ebcc1a038b2fdd3a63040509f418af Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:02:18 +0000 Subject: [PATCH 18/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 883502988abbfd29a32adb520f4626398c498beb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:02:32 +0000 Subject: [PATCH 19/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 61 files changed, 4872 insertions(+), 5599 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 5e1d5ea..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T20:11:18.829Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index e47505f..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From d930b77dee12161e6e39fe5f99b722f7e2b17d5c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 06:54:15 +0000 Subject: [PATCH 20/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd2db80..4e75b05 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3f2721955a414c0a49c4b3ee072494a0ea2a7801 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:10:25 +0000 Subject: [PATCH 21/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 887e107d5b142e37c7fcba98b7380abb8460d721 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:10:40 +0000 Subject: [PATCH 22/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 61 files changed, 4872 insertions(+), 5599 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 13e2599..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T05:04:37.576Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 4e75b05..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From c106445076d0ca7986c50655757e02df34818963 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 07:10:46 +0000 Subject: [PATCH 23/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd2db80..4e75b05 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1bef314999b713272832b30b43049ba7a2148930 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 11:47:01 +0000 Subject: [PATCH 24/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 746c1c3af157d6425f0cf0b68e582bf050e24508 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 11:47:24 +0000 Subject: [PATCH 25/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 61 files changed, 4872 insertions(+), 5599 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index c55736a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T05:16:15.754Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 4e75b05..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From f059e27cba9a1f34326fe9fcd1776526d4f0d463 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 07:04:00 +0000 Subject: [PATCH 26/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd2db80..4e75b05 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b92cd65973b80f96eb56aa4463c4fdedec3752d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:02:33 +0000 Subject: [PATCH 27/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3ff512887c0de099f6fc20604a80c142fd11cf11 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:02:51 +0000 Subject: [PATCH 28/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 61 files changed, 4872 insertions(+), 5599 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2079d0b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T05:20:16.124Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 4e75b05..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.1", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From d8cb0e3e954812be4dd56ae8e1da26f590c9af3e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 07:19:36 +0000 Subject: [PATCH 29/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6f2fb85..8a316b7 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 09b74c78a83be35a2bf24e2780bd0221fbb5835e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:13:19 +0000 Subject: [PATCH 30/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b9f10c2c0a87d1012ee0e7e708bcd6be4f2f1478 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:13:35 +0000 Subject: [PATCH 31/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 62 files changed, 4872 insertions(+), 5704 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index c5aa831..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T05:28:03.253Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 8a316b7..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From 5a06501bd855319e2440ee83f57d6be8f2e846c0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 03:44:08 +0000 Subject: [PATCH 32/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6f2fb85..8a316b7 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "@stdlib/complex-float64-reim": "^0.1.2", "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.2.2", @@ -91,4 +92,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From eb74de97bb4e03c8316c9a3a166582f9f672f241 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 04:58:48 +0000 Subject: [PATCH 33/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 99788489ca89f709125251d867764994d742181f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 04:59:02 +0000 Subject: [PATCH 34/67] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 51 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 159 +- SECURITY.md | 5 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/test.ts | 67 - examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 52 - lib/main.js | 63 - lib/native.js | 62 - manifest.json | 75 - package.json | 67 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 110 - test/test.native.js | 119 - 62 files changed, 4872 insertions(+), 5704 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (94%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js delete mode 100644 test/test.native.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index d46f112..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-30T03:10:10.674Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -125,115 +116,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -260,7 +143,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -325,11 +208,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0dedeae..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=n(function(p,t){ -var c=require('@stdlib/complex-float64-ctor/dist'),a=require('@stdlib/complex-float64-real/dist'),i=require('@stdlib/complex-float64-imag/dist');function m(e,r){var s=a(e)+a(r),v=i(e)+i(r);return new c(s,v)}t.exports=m -});var o=u();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2ffc8e7..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IChBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 648029b..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index ff5d50b..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5b938ec --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f70a4cf --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index ac93b56..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 8a316b7..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,41 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -92,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a0c2fe --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); From 308c259b03dff010c014d115c16a918b2ef594bd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 22 Jan 2025 06:59:18 +0000 Subject: [PATCH 35/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1c30edb8cc70845fe2423da0a3def2cb90ae9037 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 22 Jan 2025 06:59:45 +0000 Subject: [PATCH 36/67] Remove files --- index.d.ts | 54 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4901 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 3e37f73..0000000 --- a/index.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -declare function add( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5b938ec..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function m(m,o){var r=e(m)+e(o),i=s(m)+s(o);return new t(r,i)}export{m as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f70a4cf..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128"],"mappings":";;6RAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a0c2fe..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a73567e1dc95f9e41268cb64268e511c9d914d6e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 22 Jan 2025 07:00:01 +0000 Subject: [PATCH 37/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 95 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4880 insertions(+), 6727 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From d8cf28e3cee38e8db7740cf44b0780f5bd774db1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 01:20:56 +0000 Subject: [PATCH 38/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9163d022a797650c047aeb68d06788f28de81f15 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 01:50:20 +0000 Subject: [PATCH 39/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bcfa2b4c13a67dd8e8859d5e504dc78fd1baae4e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 01:50:41 +0000 Subject: [PATCH 40/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 95 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 69 files changed, 4880 insertions(+), 6728 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 884516f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-02-03T01:07:16.327Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2ff2513..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv +[@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math-base-ops-cdiv/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 29d3e21cb58f3b24028ac9b9c2dbb7a5bd395232 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 12 Mar 2025 06:13:49 +0000 Subject: [PATCH 41/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ef84b6de0b541b0eea6d238cfa5bddddd8f6f8b3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 12 Mar 2025 06:14:15 +0000 Subject: [PATCH 42/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ff1b31cc830b9049cee4edf346f8084d1d6e21d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 12 Mar 2025 06:14:33 +0000 Subject: [PATCH 43/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 97 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4880 insertions(+), 6733 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub +[@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math-base-ops-csub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From af5475eabe17a5515213560cbb2c6ef59aea7f57 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 15 Mar 2025 06:25:56 +0000 Subject: [PATCH 44/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d17f8263f03322d0c13b849e75909c8c7e07944d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 15 Mar 2025 06:26:15 +0000 Subject: [PATCH 45/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From fe235495075ac0f4b1a7fa845e015aee3eade7ff Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 15 Mar 2025 06:26:29 +0000 Subject: [PATCH 46/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 98 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4880 insertions(+), 6734 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 510a15407d56efc0a829707033dfa549764b29a3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 31 Mar 2025 00:59:00 +0000 Subject: [PATCH 47/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 05e69a0dd5c34d173d36bb25a4b8935ae1ad8c3b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 31 Mar 2025 01:08:03 +0000 Subject: [PATCH 48/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bb44aa44d849a657b65c6f10b94c66d4fbbda4df Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 31 Mar 2025 01:08:30 +0000 Subject: [PATCH 49/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 98 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 23 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 69 files changed, 4880 insertions(+), 6735 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 3412bc5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-03-31T00:50:57.018Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index 0588a84..0000000 --- a/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From b2062df11edbd8323658a5352c76ea00b138b2a2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Apr 2025 05:52:55 +0000 Subject: [PATCH 50/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c47a024ebc7a241ced0b76a0d420d227ecc99217 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Apr 2025 05:53:16 +0000 Subject: [PATCH 51/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9e2390fb1858229ef43f5e31fb61e93d788e60e8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Apr 2025 05:53:38 +0000 Subject: [PATCH 52/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 100 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4880 insertions(+), 6735 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 994991fb79c196b4513a70c3dbe042aa843425dc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 01:18:20 +0000 Subject: [PATCH 53/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 80fdda15dbe480030b871ca0d4d06e068e20d005 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 01:28:47 +0000 Subject: [PATCH 54/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From eb26a827e85833d54e4a35e36a98f0b0f963cfd3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 01:29:13 +0000 Subject: [PATCH 55/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 100 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 69 files changed, 4880 insertions(+), 6736 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2af17ec..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-04-07T01:12:58.270Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 85b2cf60fe797135abd7441d63cce5bea2971836 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 01:26:14 +0000 Subject: [PATCH 56/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 884a86f..7b4c57c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-float64": "^0.2.2", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b459084ac31e45443973cf79da1f266422bcb0c5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 02:22:52 +0000 Subject: [PATCH 57/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 994508fc38748eb4d282c838d2e9cbf97072cd6c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 02:23:21 +0000 Subject: [PATCH 58/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 100 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 169 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 36 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 72 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 69 files changed, 4880 insertions(+), 6736 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index daf203f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-05-26T01:21:08.981Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -180,115 +177,7 @@ for ( i = 0; i < 100; i++ ) { -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -315,7 +204,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -380,11 +269,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2d722f2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var add = require( './../lib' ); - -var rand = discreteUniform( -50, 50 ); - -var z1; -var z2; -var z3; -var i; -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = add( z1, z2 ); - console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index 7b4c57c..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -97,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 7b7539543797ec3c6a3bc31fe176c42446e6a438 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 20:29:58 +0000 Subject: [PATCH 59/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fdce3d9..c4de383 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -98,4 +99,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 4046605e0006ba119db062b942754ce226ef0c84 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 20:30:20 +0000 Subject: [PATCH 60/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 89b0b1e189cf3c2de7ad3e704c70d38d13bbac39 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 20:30:48 +0000 Subject: [PATCH 61/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 171 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 31 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 74 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4881 insertions(+), 6735 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -175,115 +172,7 @@ logEachMap( '(%s) * (%s) = %s', z1, z2, add ); -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -310,7 +199,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -375,11 +264,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index d0ff0c7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128Array = require( '@stdlib/array-complex128' ); -var discreteUniform = require( '@stdlib/random-array-discrete-uniform' ); -var logEachMap = require( '@stdlib/console-log-each-map' ); -var add = require( './../lib' ); - -// Generate an array of random values: -var z1 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); -var z2 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); - -// Scale each by a scalar constant: -logEachMap( '(%s) * (%s) = %s', z1, z2, add ); diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index c4de383..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,48 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-discrete-uniform": "^0.2.1", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -99,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 6fbf8c996387ff2f57575480cc8fc57536f6a56d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 21:40:31 +0000 Subject: [PATCH 62/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fdce3d9..c4de383 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -98,4 +99,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c5965dfea6ec2c3ae034f15cebb20647bd562e4b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 21:42:20 +0000 Subject: [PATCH 63/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 41c89bd4d00e13a496f1b941ee2e992caa1989a6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Jun 2025 21:42:39 +0000 Subject: [PATCH 64/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 171 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 31 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 63 - lib/main.js | 63 - lib/native.js | 62 - lib/strided.js | 55 - manifest.json | 75 - package.json | 74 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4881 insertions(+), 6737 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -175,115 +172,7 @@ logEachMap( '(%s) + (%s) = %s', z1, z2, add ); -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -310,7 +199,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -375,11 +264,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 9d82191..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EA6BnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,IC9DjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICRjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 41c3ede..0000000 --- a/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128Array = require( '@stdlib/array-complex128' ); -var discreteUniform = require( '@stdlib/random-array-discrete-uniform' ); -var logEachMap = require( '@stdlib/console-log-each-map' ); -var add = require( './../lib' ); - -// Generate arrays of random values: -var z1 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); -var z2 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); - -// Perform element-wise addition: -logEachMap( '(%s) + (%s) = %s', z1, z2, add ); diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..3b70c55 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index edb27e5..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index f72d8e8..0000000 --- a/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 7f90e94..0000000 --- a/lib/native.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = cadd( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index c4de383..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,48 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-discrete-uniform": "^0.2.1", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -99,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81bcc76 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); From 59616ec6c5fd2f324bfd680b847c5f06ceb245d7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Jun 2025 20:05:57 +0000 Subject: [PATCH 65/67] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fdce3d9..c4de383 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@stdlib/math-base-napi-binary": "^0.3.0", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -98,4 +99,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8375a096f055aa55a08054180385688c5bfe3ad6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Jun 2025 20:06:21 +0000 Subject: [PATCH 66/67] Remove files --- index.d.ts | 154 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5001 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 76d1d2c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex128 } from '@stdlib/types/complex'; -import { Collection, NumericArray } from '@stdlib/types/array'; - -/** -* Interface for adding two double-precision complex floating-point numbers. -*/ -interface Add { - /** - * Adds two double-precision complex floating-point numbers. - * - * @param z1 - complex number - * @param z2 - complex number - * @returns result - * - * @example - * var Complex128 = require( '@stdlib/complex-float64-ctor' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var z = new Complex128( 5.0, 3.0 ); - * // returns - * - * var out = add( z, z ); - * // returns - * - * var re = real( out ); - * // returns 10.0 - * - * var im = imag( out ); - * // returns 6.0 - */ - ( z1: Complex128, z2: Complex128 ): Complex128; - - /** - * Adds two double-precision complex floating-point numbers and assigns results to a provided output array. - * - * @param re1 - real component of the first complex number - * @param im1 - imaginary component of the first complex number - * @param re2 - real component of the second complex number - * @param im2 - imaginary component of the second complex number - * @param out - output array - * @param strideOut - stride length - * @param offsetOut - starting index - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 2 ); - * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); - * // returns [ 10.0, 6.0 ] - * - * var bool = ( out === v ); - * // returns true - */ - assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; - - /** - * Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. - * - * @param z1 - first complex number view - * @param strideZ1 - stride length for `z1` - * @param offsetZ1 - starting index for `z1` - * @param z2 - second complex number view - * @param strideZ2 - stride length for `z2` - * @param offsetZ2 - starting index for `z2` - * @param out - output array - * @param strideOut - stride length for `out` - * @param offsetOut - starting index for `out` - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var z1 = new Float64Array( [ 5.0, 3.0 ] ); - * var z2 = new Float64Array( [ 5.0, 3.0 ] ); - * - * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); - * // returns [ 10.0, 6.0 ] - */ - strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; -} - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var real = require( '@stdlib/complex-float64-real' ); -* var imag = require( '@stdlib/complex-float64-imag' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* // returns -* -* var out = add( z, z ); -* // returns -* -* var re = real( out ); -* // returns 10.0 -* -* var im = imag( out ); -* // returns 6.0 -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = new Float64Array( 2 ); -* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); -* // returns [ 10.0, 6.0 ] -* -* var bool = ( out === v ); -* // returns true -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ 5.0, 3.0 ] ); -* -* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 10.0, 6.0 ] -*/ -declare var add: Add; - - -// EXPORTS // - -export = add; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a5d981e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 3b70c55..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*\n* var out = cadd( z, z );\n* // returns \n*\n* var re = real( out );\n* // returns 10.0\n*\n* var im = imag( out );\n* // returns 6.0\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZAqDA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCjBA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCKAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 81bcc76..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c22380d188a7b130851d831df80eb0c6b3e4c530 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Jun 2025 20:06:36 +0000 Subject: [PATCH 67/67] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 105 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 167 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 70 - benchmark/benchmark.js | 60 - benchmark/benchmark.native.js | 69 - benchmark/benchmark.strided.js | 68 - benchmark/c/Makefile | 126 - benchmark/c/benchmark.c | 143 - benchmark/c/native/Makefile | 146 - benchmark/c/native/benchmark.c | 147 - benchmark/julia/REQUIRE | 2 - benchmark/julia/benchmark.jl | 144 - binding.gyp | 170 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 10 - dist/index.js.map | 7 - docs/repl.txt | 118 - docs/types/test.ts | 359 -- examples/c/Makefile | 146 - examples/c/example.c | 46 - examples/index.js | 31 - include.gypi | 53 - include/stdlib/complex/float64/base/add.h | 40 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 50 - lib/index.js | 54 - lib/main.js | 54 - lib/native.js | 53 - lib/strided.js | 55 - manifest.json | 75 - package.json | 74 +- src/Makefile | 70 - src/addon.c | 22 - src/main.c | 60 - stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 132 - test/test.js | 46 - test/test.main.js | 110 - test/test.native.js | 119 - test/test.strided.js | 158 - 68 files changed, 4879 insertions(+), 6709 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.native.js delete mode 100644 benchmark/benchmark.strided.js delete mode 100644 benchmark/c/Makefile delete mode 100644 benchmark/c/benchmark.c delete mode 100644 benchmark/c/native/Makefile delete mode 100644 benchmark/c/native/benchmark.c delete mode 100644 benchmark/julia/REQUIRE delete mode 100644 benchmark/julia/benchmark.jl delete mode 100644 binding.gyp delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/c/Makefile delete mode 100644 examples/c/example.c delete mode 100644 examples/index.js delete mode 100644 include.gypi delete mode 100644 include/stdlib/complex/float64/base/add.h rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/native.js delete mode 100644 lib/strided.js delete mode 100644 manifest.json delete mode 100644 src/Makefile delete mode 100644 src/addon.c delete mode 100644 src/main.c create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js delete mode 100644 test/test.native.js delete mode 100644 test/test.strided.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b21cbcf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 49f90f2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 88016b4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '18 18 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -167,115 +164,7 @@ logEachMap( '(%s) + (%s) = %s', z1, z2, add ); -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/complex/float64/base/add.h" -``` - -#### stdlib_base_complex128_add( z1, z2 ) - -Adds two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); - -stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); - -double re = stdlib_complex128_real( out ); -// returns 6.0 - -double im = stdlib_complex128_imag( out ); -// returns -4.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "add(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- @@ -302,7 +191,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -367,11 +256,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div +[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/complex-float64-base-div/tree/esm -[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul/tree/esm -[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub +[@stdlib/complex/float64/base/sub]: https://github.com/stdlib-js/complex-float64-base-sub/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f26aa4f..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':assign', function benchmark( b ) { - var out; - var re; - var im; - var N; - var i; - var j; - var k; - - N = 100; - re = uniform( N, -500.0, 500.0, options ); - im = uniform( N, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = i % N; - k = ( i+1 ) % N; - out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7d128ee..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var pkg = require( './../package.json' ).name; -var cadd = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js deleted file mode 100644 index cf78553..0000000 --- a/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cadd = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cadd instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cadd( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.strided.js b/benchmark/benchmark.strided.js deleted file mode 100644 index 4a64401..0000000 --- a/benchmark/benchmark.strided.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-array-uniform' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Float64Array = require( '@stdlib/array-float64' ); -var pkg = require( './../package.json' ).name; -var add = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg+':strided', function benchmark( b ) { - var out; - var z1; - var z2; - var N; - var i; - var j; - - N = 50; - z1 = uniform( N*2, -500.0, 500.0, options ); - z2 = uniform( N*2, -500.0, 500.0, options ); - - out = new Float64Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - j = ( i % N ) * 2; - out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile deleted file mode 100644 index d7adc1a..0000000 --- a/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c deleted file mode 100644 index a022158..0000000 --- a/benchmark/c/benchmark.c +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - z3 = (creal(z1)+creal(z2)) + (cimag(z1)+cimag(z2))*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/c/native/Makefile b/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4..0000000 --- a/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c deleted file mode 100644 index 056d60c..0000000 --- a/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,147 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "add" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_complex128_add( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/benchmark/julia/REQUIRE b/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e1..0000000 --- a/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/benchmark/julia/benchmark.jl b/benchmark/julia/benchmark.jl deleted file mode 100644 index 46d2ac4..0000000 --- a/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "add"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) + ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index ad8560b..0000000 --- a/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/branches.md b/branches.md deleted file mode 100644 index d8e52f2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add" -%% click B href "https://github.com/stdlib-js/complex-float64-base-add/tree/main" -%% click C href "https://github.com/stdlib-js/complex-float64-base-add/tree/production" -%% click D href "https://github.com/stdlib-js/complex-float64-base-add/tree/esm" -%% click E href "https://github.com/stdlib-js/complex-float64-base-add/tree/deno" -%% click F href "https://github.com/stdlib-js/complex-float64-base-add/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add -[production-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/production -[deno-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/deno -[deno-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/umd -[umd-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/complex-float64-base-add/tree/esm -[esm-readme]: https://github.com/stdlib-js/complex-float64-base-add/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index f6afaac..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import add from '../docs/types/index'; -export = add; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 622f56f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var x=u(function(B,p){ -var R=require('@stdlib/complex-float64-ctor/dist'),c=require('@stdlib/complex-float64-real/dist'),q=require('@stdlib/complex-float64-imag/dist');function b(e,r){var i=c(e)+c(r),s=q(e)+q(r);return new R(i,s)}p.exports=b -});var m=u(function(D,g){ -function h(e,r,i,s,n,t,a){return n[a]=e+i,n[a+t]=r+s,n}g.exports=h -});var w=u(function(E,l){ -function j(e,r,i,s,n,t,a,C,v){return a[v]=e[i]+s[t],a[v+C]=e[i+r]+s[t+n],a}l.exports=j -});var y=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=x(),k=m(),o=w();y(d,"assign",k);y(d,"strided",o);module.exports=d; -/** @license Apache-2.0 */ -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2633f19..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/assign.js", "../lib/strided.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var out = cadd( z, z );\n* // returns [ 10.0, 6.0 ]\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cadd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strided;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var cadd = require( '@stdlib/complex-float64-base-add' );\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var out = cadd( z, z );\n* // returns [ 10.0, 6.0 ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\nvar strided = require( './strided.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,8BAA+B,EACrDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EAoBnD,SAASC,EAAMC,EAAIC,EAAK,CACvB,IAAIC,EAAKL,EAAMG,CAAG,EAAIH,EAAMI,CAAG,EAC3BE,EAAKL,EAAME,CAAG,EAAIF,EAAMG,CAAG,EAC/B,OAAO,IAAIL,EAAYM,EAAIC,CAAG,CAC/B,CAKAR,EAAO,QAAUI,ICrDjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,EAAY,CAChE,OAAAF,EAAKE,CAAU,EAAIN,EAAME,EACzBE,EAAKE,EAAUD,CAAU,EAAIJ,EAAME,EAC5BC,CACR,CAKAN,EAAO,QAAUC,ICjDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAASC,EAAIC,EAAUC,EAAUC,EAAIC,EAAUC,EAAUC,EAAKC,EAAWC,EAAY,CAC7F,OAAAF,EAAKE,CAAU,EAAIR,EAAIE,CAAS,EAAIC,EAAIE,CAAS,EACjDC,EAAKE,EAAUD,CAAU,EAAIP,EAAIE,EAASD,CAAS,EAAIE,EAAIE,EAASD,CAAS,EACtEE,CACR,CAKAR,EAAO,QAAUC,ICjBjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IACTC,EAAU,IAKdH,EAAaC,EAAM,SAAUC,CAAO,EACpCF,EAAaC,EAAM,UAAWE,CAAQ,EAKtC,OAAO,QAAUF", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "real", "imag", "cadd", "z1", "z2", "re", "im", "require_assign", "__commonJSMin", "exports", "module", "assign", "re1", "im1", "re2", "im2", "out", "strideOut", "offsetOut", "require_strided", "__commonJSMin", "exports", "module", "strided", "z1", "strideZ1", "offsetZ1", "z2", "strideZ2", "offsetZ2", "out", "strideOut", "offsetOut", "setReadOnly", "main", "assign", "strided"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 48b89d1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,118 +0,0 @@ - -{{alias}}( z1, z2 ) - Adds two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var out = {{alias}}( z, z ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - 10.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - 6.0 - - -{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) - Adds two double-precision complex floating-point numbers and assigns results - to a provided output array. - - Parameters - ---------- - re1: number - Real component of the first complex number. - - im1: number - Imaginary component of the first complex number. - - re2: number - Real component of the second complex number. - - im2: number - Imaginary component of the second complex number. - - out: ArrayLikeObject - Output array. - - strideOut: integer - Stride length. - - offsetOut: integer - Starting index. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) - [ 3.0, 4.0 ] - - -{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) - Adds two double-precision complex floating-point numbers stored in real- - valued strided array views and assigns results to a provided strided output - array. - - Parameters - ---------- - z1: ArrayLikeObject - First complex number view. - - sz1: integer - Stride length for `z1`. - - oz1: integer - Starting index for `z1`. - - z2: ArrayLikeObject - Second complex number view. - - sz2: integer - Stride length for `z2`. - - oz2: integer - Starting index for `z2`. - - out: ArrayLikeObject - Output array. - - so: integer - Stride length for `out`. - - oo: integer - Starting index for `out`. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var z1 = new {{alias:@stdlib/array/float64}}( [ 5.0, 3.0 ] ); - > var z2 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0 ] ); - > var out = new {{alias:@stdlib/array/float64}}( 2 ); - > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) - [ 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3cb68ff..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex128 = require( '@stdlib/complex-float64-ctor' ); -import add = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( true, z ); // $ExpectError - add( false, z ); // $ExpectError - add( null, z ); // $ExpectError - add( undefined, z ); // $ExpectError - add( '5', z ); // $ExpectError - add( [], z ); // $ExpectError - add( {}, z ); // $ExpectError - add( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - add( z, true ); // $ExpectError - add( z, false ); // $ExpectError - add( z, null ); // $ExpectError - add( z, undefined ); // $ExpectError - add( z, '5' ); // $ExpectError - add( z, [] ); // $ExpectError - add( z, {} ); // $ExpectError - add( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - add(); // $ExpectError - add( z ); // $ExpectError - add( z, z, z ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - add.assign( 1.0, 1.0, 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... -{ - add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... -{ - const out = new Float64Array( 2 ); - - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = new Float64Array( 2 ); - - add.assign(); // $ExpectError - add.assign( 1.0 ); // $ExpectError - add.assign( 1.0, 2.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError - add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError -} - -// Attached to the main export is a `strided` method which returns a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array - add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array - add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] -} - -// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a second argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a third argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( 2 ); - - add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - - add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... -{ - const z1 = new Float64Array( 2 ); - const z2 = new Float64Array( z1.length ); - const out = new Float64Array( z2.length ); - - add.strided(); // $ExpectError - add.strided( z1 ); // $ExpectError - add.strided( z1, 1 ); // $ExpectError - add.strided( z1, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError - add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError -} - - diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 70c91f4..0000000 --- a/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index c92c221..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - - y = stdlib_base_complex128_add( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cadd(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 41c3ede..0000000 --- a/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex128Array = require( '@stdlib/array-complex128' ); -var discreteUniform = require( '@stdlib/random-array-discrete-uniform' ); -var logEachMap = require( '@stdlib/console-log-each-map' ); -var add = require( './../lib' ); - -// Generate arrays of random values: -var z1 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); -var z2 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); - -// Perform element-wise addition: -logEachMap( '(%s) + (%s) = %s', z1, z2, add ); diff --git a/include.gypi b/include.gypi deleted file mode 100644 index 98e37f1..0000000 --- a/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' +/// import { Complex128 } from '@stdlib/types/complex'; import { Collection, NumericArray } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a5d981e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@v0.0.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-real@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-imag@v0.1.1-esm/index.mjs";function r(t,r){var i=s(t)+s(r),o=n(t)+n(r);return new e(i,o)}function i(t,e,s,n,r,i,o){return r[o]=t+s,r[o+i]=e+n,r}function o(t,e,s,n,r,i,o,d,m){return o[m]=t[s]+n[i],o[m+d]=t[s+e]+n[i+r],o}t(r,"assign",i),t(r,"strided",o);export{i as assign,r as default,o as strided}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..fdafdf3 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/assign.js","../lib/strided.js","../lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Complex128 from '@stdlib/complex-float64-ctor';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers.\n*\n* @param {Complex128} z1 - complex number\n* @param {Complex128} z2 - complex number\n* @returns {Complex128} result\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var out = cadd( z, z );\n* // returns [ 10.0, 6.0 ]\n*/\nfunction cadd( z1, z2 ) {\n\tvar re = real( z1 ) + real( z2 );\n\tvar im = imag( z1 ) + imag( z2 );\n\treturn new Complex128( re, im );\n}\n\n\n// EXPORTS //\n\nexport default cadd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers and assigns results to a provided output array.\n*\n* @param {number} re1 - real component of the first complex number\n* @param {number} im1 - imaginary component of the first complex number\n* @param {number} re2 - real component of the second complex number\n* @param {number} im2 - imaginary component of the second complex number\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length\n* @param {NonNegativeInteger} offsetOut - starting index\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction assign( re1, im1, re2, im2, out, strideOut, offsetOut ) {\n\tout[ offsetOut ] = re1 + re2;\n\tout[ offsetOut+strideOut ] = im1 + im2;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array.\n*\n* @param {Float64Array} z1 - first complex number view\n* @param {integer} strideZ1 - stride length for `z1`\n* @param {NonNegativeInteger} offsetZ1 - starting index for `z1`\n* @param {Float64Array} z2 - second complex number view\n* @param {integer} strideZ2 - stride length for `z2`\n* @param {NonNegativeInteger} offsetZ2 - starting index for `z2`\n* @param {Collection} out - output array\n* @param {integer} strideOut - stride length for `out`\n* @param {NonNegativeInteger} offsetOut - starting index for `out`\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var z1 = new Float64Array( [ 5.0, 3.0 ] );\n* var z2 = new Float64Array( [ -2.0, 1.0 ] );\n*\n* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len\n\tout[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ];\n\tout[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default strided;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Add two double-precision complex floating-point numbers.\n*\n* @module @stdlib/complex-float64-base-add\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import cadd from '@stdlib/complex-float64-base-add';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var out = cadd( z, z );\n* // returns [ 10.0, 6.0 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\nimport strided from './strided.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\nsetReadOnly( main, 'strided', strided );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"assign\": \"main.assign\", \"strided\": \"main.strided\" }\n"],"names":["cadd","z1","z2","re","real","im","imag","Complex128","assign","re1","im1","re2","im2","out","strideOut","offsetOut","strided","strideZ1","offsetZ1","strideZ2","offsetZ2","setReadOnly","main"],"mappings":";;qZA4CA,SAASA,EAAMC,EAAIC,GAClB,IAAIC,EAAKC,EAAMH,GAAOG,EAAMF,GACxBG,EAAKC,EAAML,GAAOK,EAAMJ,GAC5B,OAAO,IAAIK,EAAYJ,EAAIE,EAC5B,CCRA,SAASG,EAAQC,EAAKC,EAAKC,EAAKC,EAAKC,EAAKC,EAAWC,GAGpD,OAFAF,EAAKE,GAAcN,EAAME,EACzBE,EAAKE,EAAUD,GAAcJ,EAAME,EAC5BC,CACR,CCCA,SAASG,EAASf,EAAIgB,EAAUC,EAAUhB,EAAIiB,EAAUC,EAAUP,EAAKC,EAAWC,GAGjF,OAFAF,EAAKE,GAAcd,EAAIiB,GAAahB,EAAIkB,GACxCP,EAAKE,EAAUD,GAAcb,EAAIiB,EAASD,GAAaf,EAAIkB,EAASD,GAC7DN,CACR,CCJAQ,EAAAC,EAAA,SAAAd,GACAa,EAAAC,EAAA,UAAAN"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 2601ce6..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers and assigns results to a provided output array. -* -* @param {number} re1 - real component of the first complex number -* @param {number} im1 - imaginary component of the first complex number -* @param {number} re2 - real component of the second complex number -* @param {number} im2 - imaginary component of the second complex number -* @param {Collection} out - output array -* @param {integer} strideOut - stride length -* @param {NonNegativeInteger} offsetOut - starting index -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { - out[ offsetOut ] = re1 + re2; - out[ offsetOut+strideOut ] = im1 + im2; - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index cb9c5b9..0000000 --- a/lib/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Add two double-precision complex floating-point numbers. -* -* @module @stdlib/complex-float64-base-add -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* var cadd = require( '@stdlib/complex-float64-base-add' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* -* var out = cadd( z, z ); -* // returns [ 10.0, 6.0 ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); -var strided = require( './strided.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); -setReadOnly( main, 'strided', strided ); - - -// EXPORTS // - -module.exports = main; - -// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index c785d2d..0000000 --- a/lib/main.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* -* var out = cadd( z, z ); -* // returns [ 10.0, 6.0 ] -*/ -function cadd( z1, z2 ) { - var re = real( z1 ) + real( z2 ); - var im = imag( z1 ) + imag( z2 ); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/native.js b/lib/native.js deleted file mode 100644 index 2b3cac9..0000000 --- a/lib/native.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex-float64-ctor' ); -* -* var z = new Complex128( 5.0, 3.0 ); -* -* var out = cadd( z, z ); -* // returns [ 10.0, 6.0 ] -*/ -function cadd( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cadd; diff --git a/lib/strided.js b/lib/strided.js deleted file mode 100644 index 093318a..0000000 --- a/lib/strided.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Adds two double-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. -* -* @param {Float64Array} z1 - first complex number view -* @param {integer} strideZ1 - stride length for `z1` -* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` -* @param {Float64Array} z2 - second complex number view -* @param {integer} strideZ2 - stride length for `z2` -* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` -* @param {Collection} out - output array -* @param {integer} strideOut - stride length for `out` -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Collection} output array -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* var z1 = new Float64Array( [ 5.0, 3.0 ] ); -* var z2 = new Float64Array( [ -2.0, 1.0 ] ); -* -* var out = strided( z1, 1, 0, z2, 1, 0, new Float64Array( 2 ), 1, 0 ); -* // returns [ 3.0, 4.0 ] -*/ -function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len - out[ offsetOut ] = z1[ offsetZ1 ] + z2[ offsetZ2 ]; - out[ offsetOut+strideOut ] = z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ]; // eslint-disable-line max-len - return out; -} - - -// EXPORTS // - -module.exports = strided; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 186509e..0000000 --- a/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math-base-napi-binary", - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float64-ctor", - "@stdlib/complex-float64-reim" - ] - } - ] -} diff --git a/package.json b/package.json index c4de383..dead96a 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.1.0", "description": "Add two double-precision complex floating-point numbers.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": false, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,48 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/complex-float64-reim": "^0.1.2", - "@stdlib/math-base-napi-binary": "^0.3.0", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-array-discrete-uniform": "^0.2.1", - "@stdlib/random-array-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-try-require": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdmath", @@ -99,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a28d898..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/src/addon.c b/src/addon.c deleted file mode 100644 index ee2809e..0000000 --- a/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/math/base/napi/binary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_complex128_add ) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index e30df7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/complex/float64/base/add.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Adds two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 ); -* -* stdlib_complex128_t out = stdlib_base_complex128_add( z, z ); -* -* double re = stdlib_complex128_real( out ); -* // returns 6.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -4.0 -*/ -stdlib_complex128_t stdlib_base_complex128_add( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = re1 + re2; - im = im1 + im2; - - return stdlib_complex128( re, im ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..00d6334 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 3fdecae..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 4 ); - v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var v; - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 990fa61..0000000 --- a/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isMethod = require( '@stdlib/assert-is-method' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main export is a `strided` method', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 89c0ea2..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var add = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.native.js b/test/test.native.js deleted file mode 100644 index bdce62a..0000000 --- a/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var tryRequire = require( '@stdlib/utils-try-require' ); - - -// VARIABLES // - -var add = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( imag( v ), 4.0, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( real( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.strided.js b/test/test.strided.js deleted file mode 100644 index aa958cf..0000000 --- a/test/test.strided.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Float64Array = require( '@stdlib/array-float64' ); -var add = require( './../lib/strided.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds two complex numbers', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - - expected = new Float64Array( [ 3.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 0.0, 3.0, 0.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); - - expected = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ 0.0, -2.0, 0.0, 1.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); - - expected = new Float64Array( [ 0.0, 3.0, 0.0, 4.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 3.0, 5.0 ] ); - z2 = new Float64Array( [ 1.0, -2.0 ] ); - out = new Float64Array( 4 ); - v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); - - expected = new Float64Array( [ 0.0, 4.0, 0.0, 3.0 ] ); - - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { - var expected; - var out; - var z1; - var z2; - var v; - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, 3.0 ] ); - z2 = new Float64Array( [ NaN, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, 4.0 ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, 1.0 ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, 3.0 ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ 5.0, NaN ] ); - z2 = new Float64Array( [ -2.0, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ 3.0, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - z1 = new Float64Array( [ NaN, NaN ] ); - z2 = new Float64Array( [ NaN, NaN ] ); - out = new Float64Array( 2 ); - expected = new Float64Array( [ NaN, NaN ] ); - - v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); - t.strictEqual( v, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); - - t.end(); -});