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 884a86f..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,45 +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" - }, - "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", 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(); -});