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 a20cad7..0000000
--- a/.github/.keepalive
+++ /dev/null
@@ -1 +0,0 @@
-2025-04-14T00:31:16.651Z
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index 5b48e10..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/ndarray/ctor) 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 87e7c1a..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/ndarray/ctor) 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 5a4c3e6..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: '1 1 * * 2'
-
- # 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
+```
-```javascript
-var ndarray = require( '@stdlib/ndarray-ctor' );
+If no recognized module system is present, access bundle contents via the global scope:
+
+```html
+
```
@@ -678,9 +684,14 @@ The method does **not** serialize data outside of the buffer region defined by t
-```javascript
-var Float32Array = require( '@stdlib/array-float32' );
-var ndarray = require( '@stdlib/ndarray-ctor' );
+```html
+
+
+
+
+
+
+
+
```
@@ -726,2842 +742,7 @@ str = JSON.stringify( arr.toJSON() );
-* * *
-
-
-
-## C APIs
-
-
-
-
-
-
-
-
-
-
-
-### Usage
-
-```c
-#include "stdlib/ndarray/ctor.h"
-```
-
-#### ndarray
-
-Structure holding ndarray data.
-
-```c
-#include "stdlib/ndarray/dtypes.h"
-#include "stdlib/ndarray/index_modes.h"
-#include "stdlib/ndarray/orders.h"
-#include "stdlib/ndarray/base/bytes_per_element.h"
-#include
-
-struct ndarray {
- // Underlying data type:
- int16_t dtype;
-
- // Pointer to the underlying byte array:
- uint8_t *data;
-
- // Number of array dimensions:
- int64_t ndims;
-
- // Array shape (dimensions):
- int64_t *shape;
-
- // Array strides (in bytes) specifying how to iterate over a strided array:
- int64_t *strides;
-
- // Byte offset which specifies the location at which to start iterating over array elements:
- int64_t offset;
-
- // Array order (either row-major (C-style) or column-major (Fortran-style)):
- int8_t order;
-
- // Mode specifying how to handle indices which exceed array dimensions:
- int8_t imode;
-
- // Number of subscript modes:
- int64_t nsubmodes;
-
- // Mode(s) specifying how to handle subscripts which exceed array dimensions on a per dimension basis:
- int8_t *submodes;
-
- // Number of array elements:
- int64_t length;
-
- // Size in bytes:
- int64_t byteLength;
-
- // Number of bytes per element (i.e., item size):
- int64_t BYTES_PER_ELEMENT;
-
- // Bit mask providing information regarding the memory layout of the array (e.g., see macros):
- int64_t flags;
-};
-```
-
-#### STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG
-
-Macro defining a flag indicating whether an ndarray is row-major (C-style) contiguous.
-
-```c
-#define STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG 0x0001
-```
-
-Notes:
-
-- Row-major order indicates that the last ndarray index varies the fastest.
-- Contiguous means that an ndarray is compatible with being stored in a single memory segment and that ndarray elements are adjacent to each other in memory.
-- `strides` array is in reverse order to that of column-major order.
-- An ndarray can be both row-major and column-major contiguous (e.g., if an ndarray is one-dimensional).
-
-#### STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG
-
-Macro defining a flag indicating whether an ndarray is column-major (Fortran-style) contiguous.
-
-```c
-#define STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG 0x0002
-```
-
-Notes:
-
-- Column-major order indicates that the first ndarray index varies the fastest.
-- Contiguous means that an ndarray is compatible with being stored in a single memory segment and that ndarray elements are adjacent to each other in memory.
-- `strides` array is in reverse order to that of row-major order.
-- An ndarray can be both row-major and column-major contiguous (e.g., if an ndarray is one-dimensional).
-
-* * *
-
-
-
-#### stdlib_ndarray_allocate( dtype, \*data, ndims, \*shape, \*strides, offset, order, imode, nsubmodes, \*submodes )
-
-Returns a pointer to a dynamically allocated ndarray.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/dtypes.h"
-#include "stdlib/ndarray/index_modes.h"
-#include "stdlib/ndarray/orders.h"
-#include "stdlib/ndarray/base/bytes_per_element.h"
-#include
-#include
-#include
-
-// Specify the underlying data type:
-enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT64;
-
-// Create an underlying byte array:
-uint8_t buffer[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-// Specify the number of array dimensions:
-int64_t ndims = 1;
-
-// Specify the array shape:
-int64_t shape[] = { 3 }; // vector consisting of 3 doubles
-
-// Specify the array strides:
-int64_t strides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT };
-
-// Specify the byte offset:
-int64_t offset = 0;
-
-// Specify the array order (note: this does not matter for a 1-dimensional array):
-enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
-
-// Specify the index mode:
-enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
-
-// Specify the subscript index modes:
-int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-int64_t nsubmodes = 1;
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( dtype, buffer, ndims, shape, strides, offset, order, imode, nsubmodes, submodes );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **dtype**: `[in] int16_t` [data type][@stdlib/ndarray/dtypes].
-- **data**: `[in] uint8_t*` pointer to the underlying byte array.
-- **ndims**: `[in] int64_t` number of dimensions.
-- **shape**: `[in] int64_t*` array shape (i.e., dimensions).
-- **strides**: `[in] int64_t*` array strides (in bytes).
-- **offset**: `[in] int64_t` byte offset specifying the location of the first element.
-- **order**: `[in] int8_t` specifies whether an array is [row-major][@stdlib/ndarray/orders] (C-style) or [column-major][@stdlib/ndarray/orders] (Fortran-style).
-- **imode**: `[in] int8_t` specifies the [index mode][@stdlib/ndarray/index-modes] (i.e., how to handle indices which exceed array dimensions).
-- **nsubmodes**: `[in] int64_t` number of subscript modes.
-- **submodes**: `[in] int8_t*` specifies how to handle subscripts which [exceed][@stdlib/ndarray/index-modes] array dimensions on a per dimension basis (if provided fewer submodes than dimensions, submodes are recycled using modulo arithmetic).
-
-```c
-struct ndarray * stdlib_ndarray_allocate( int16_t dtype, uint8_t *data, int64_t ndims, int64_t *shape, int64_t *strides, int64_t offset, int8_t order, int8_t imode, int64_t nsubmodes, int8_t *submodes );
-```
-
-Notes:
-
-- The user is responsible for freeing the allocated memory.
-- To allocate a zero-dimensional ndarray, provide a `shape` argument equal to a null pointer, an `ndims` argument equal to `0`, and a `strides` argument consisting of a single element equal to `0`. The `order` argument can be either row-major or column-major and has no effect on data storage or access.
-
-#### stdlib_ndarray_bytelength( \*arr )
-
-Returns the size of an ndarray (in bytes).
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the ndarray size:
-int64_t N = stdlib_ndarray_bytelength( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_bytelength( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_data( \*arr )
-
-Returns a pointer to an ndarray's underlying byte array.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the underlying byte array:
-uint8_t *data = stdlib_ndarray_data( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-uint8_t * stdlib_ndarray_data( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_dimension( \*arr, i )
-
-Returns an ndarray dimension.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve a dimension:
-int64_t dim = stdlib_ndarray_dimension( x, 0 );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **i**: `[in] int64_t` dimension index.
-
-```c
-int64_t stdlib_ndarray_dimension( const struct ndarray *arr, const int64_t i );
-```
-
-Notes:
-
-- The function does perform bounds checking for the dimension index.
-- If an input ndarray is zero-dimensional, the function always returns `-1`.
-
-#### stdlib_ndarray_disable_flags( \*arr, flags )
-
-Disables specified ndarray flags.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Disables specified ndarray flags:
-int8_t status = stdlib_ndarray_disable_flags( x, STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **flags**: `[in] int64_t` bit mask to disable flags.
-
-The function returns a status code of `0` if able to successfully disable flags.
-
-```c
-int8_t stdlib_ndarray_disable_flags( const struct ndarray *arr, const int64_t flags );
-```
-
-Notes:
-
-- The function does not perform any sanity checks and **assumes** the user knows what s/he is doing.
-
-#### stdlib_ndarray_dtype( \*arr )
-
-Returns the data type of an ndarray.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/dtypes.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the dtype:
-enum STDLIB_NDARRAY_DTYPE dtype = stdlib_ndarray_dtype( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int16_t stdlib_ndarray_dtype( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_enable_flags( \*arr, flags )
-
-Enables specified ndarray flags.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Enables specified ndarray flags:
-int8_t status = stdlib_ndarray_enable_flags( x, STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **flags**: `[in] int64_t` bit mask to enable flags.
-
-The function returns a status code of `0` if able to successfully enable flags.
-
-```c
-int8_t stdlib_ndarray_enable_flags( const struct ndarray *arr, const int64_t flags );
-```
-
-Notes:
-
-- The function does not perform any sanity checks and **assumes** the user knows what s/he is doing.
-
-#### stdlib_ndarray_flags( \*arr )
-
-Returns ndarray flags as a single integer value.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the ndarray flags:
-int64_t flags = stdlib_ndarray_flags( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_flags( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_free( \*arr )
-
-Frees an ndarray's allocated memory.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-void stdlib_ndarray_free( struct ndarray *arr );
-```
-
-#### stdlib_ndarray_has_flags( \*arr, flags )
-
-Tests whether an ndarray has specified flags enabled.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Test whether an ndarray is row-major contiguous:
-int8_t out = stdlib_ndarray_flags( x, STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **flags**: `[in] int64_t` bit mask specifying flags to test against.
-
-The function returns `1` if flags are set and `0` otherwise.
-
-```c
-int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags );
-```
-
-#### stdlib_ndarray_index_mode( \*arr )
-
-Returns the index mode of an ndarray.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/index_modes.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the index mode:
-enum STDLIB_NDARRAY_INDEX_MODE imode = stdlib_ndarray_index_mode( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int8_t stdlib_ndarray_index_mode( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_length( \*arr )
-
-Returns the number of elements in an ndarray.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the number of elements:
-int64_t N = stdlib_ndarray_length( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_length( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_ndims( \*arr )
-
-Returns the number of ndarray dimensions.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the number of dimensions:
-int64_t ndims = stdlib_ndarray_ndims( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_ndims( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_nsubmodes( \*arr )
-
-Returns the number of ndarray subscript modes.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the number of index modes:
-int64_t n = stdlib_ndarray_nsubmodes( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_nsubmodes( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_offset( \*arr )
-
-Returns an ndarray index offset (in bytes).
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the index offset:
-int64_t offset = stdlib_ndarray_offset( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t stdlib_ndarray_offset( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_order( \*arr )
-
-Returns the order of an ndarray.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/orders.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the order:
-enum STDLIB_NDARRAY_ORDER order = stdlib_ndarray_order( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int8_t stdlib_ndarray_order( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_shape( \*arr )
-
-Returns a pointer to an array containing an ndarray shape (dimensions).
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the shape:
-int64_t *shape = stdlib_ndarray_shape( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t * stdlib_ndarray_shape( const struct ndarray *arr );
-```
-
-Notes:
-
-- If an input ndarray is zero-dimensional, the function returns a null pointer.
-
-#### stdlib_ndarray_stride( \*arr, i )
-
-Returns an ndarray stride (in bytes).
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve a stride:
-int64_t s = stdlib_ndarray_stride( x, 0 );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **i**: `[in] int64_t` dimension index.
-
-```c
-int64_t stdlib_ndarray_stride( const struct ndarray *arr, const int64_t i );
-```
-
-Notes:
-
-- The function does perform bounds checking for the dimension index.
-
-#### stdlib_ndarray_strides( \*arr )
-
-Returns a pointer to an array containing ndarray strides (in bytes).
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the strides:
-int64_t *strides = stdlib_ndarray_strides( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int64_t * stdlib_ndarray_strides( const struct ndarray *arr );
-```
-
-#### stdlib_ndarray_submode( \*arr, i )
-
-Returns an ndarray subscript mode.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/index_modes.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve an index mode:
-enum STDLIB_NDARRAY_INDEX_MODE mode = stdlib_ndarray_submode( x, 0 );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **i**: `[in] int64_t` dimension index.
-
-```c
-int8_t stdlib_ndarray_submode( const struct ndarray *arr, const int64_t i );
-```
-
-Notes:
-
-- If an ndarray has fewer subscript modes than dimensions, modes are recycled using modulo arithmetic.
-- The function does not perform bounds checking for the dimension index.
-
-#### stdlib_ndarray_submodes( \*arr )
-
-Returns ndarray subscript modes.
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/index_modes.h"
-#include
-#include
-
-// ...
-
-// Create an ndarray:
-struct ndarray *x = stdlib_ndarray_allocate( ... );
-if ( x == NULL ) {
- fprintf( stderr, "Error allocating memory.\n" );
- exit( 1 );
-}
-
-// ...
-
-// Retrieve the index subscript modes:
-int8_t *modes = stdlib_ndarray_submodes( x );
-
-// ...
-
-// Free allocated memory:
-stdlib_ndarray_free( x );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-
-```c
-int8_t * stdlib_ndarray_submodes( const struct ndarray *arr );
-```
-
-* * *
-
-#### stdlib_ndarray_get( \*arr, \*sub, \*out )
-
-Returns an ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get( const struct ndarray *arr, const int64_t *sub, void *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] void *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function requires a `void` pointer for the output address `out` in order to provide a generic API supporting ndarrays having different data types.
-
-#### stdlib_ndarray_get_float64( \*arr, \*sub, \*out )
-
-Returns a double-precision floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_float64( const struct ndarray *arr, const int64_t *sub, double *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] double *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_float32( \*arr, \*sub, \*out )
-
-Returns a single-precision floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_float32( const struct ndarray *arr, const int64_t *sub, float *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] float *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_uint64( \*arr, \*sub, \*out )
-
-Returns an unsigned 64-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_uint64( const struct ndarray *arr, const int64_t *sub, uint64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] uint64_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_int64( \*arr, \*sub, \*out )
-
-Returns a signed 64-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_int64( const struct ndarray *arr, const int64_t *sub, int64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] int64_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_uint32( \*arr, \*sub, \*out )
-
-Returns an unsigned 32-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_uint32( const struct ndarray *arr, const int64_t *sub, uint32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] uint32_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_int32( \*arr, \*sub, \*out )
-
-Returns a signed 32-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_int32( const struct ndarray *arr, const int64_t *sub, int32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] int32_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_uint16( \*arr, \*sub, \*out )
-
-Returns an unsigned 16-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_uint16( const struct ndarray *arr, const int64_t *sub, uint16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] uint16_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_int16( \*arr, \*sub, \*out )
-
-Returns a signed 16-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_int16( const struct ndarray *arr, const int64_t *sub, int16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] int16_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_uint8( \*arr, \*sub, \*out )
-
-Returns an unsigned 8-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_uint8( const struct ndarray *arr, const int64_t *sub, uint8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] uint8_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_int8( \*arr, \*sub, \*out )
-
-Returns a signed 8-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_int8( const struct ndarray *arr, const int64_t *sub, int8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] int8_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_complex128( \*arr, \*sub, \*out )
-
-Returns a double-precision complex floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_complex128( const struct ndarray *arr, const int64_t *sub, stdlib_complex128_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] stdlib_complex128_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_complex64( \*arr, \*sub, \*out )
-
-Returns a single-precision complex floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_complex64( const struct ndarray *arr, const int64_t *sub, stdlib_complex64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] stdlib_complex64_t *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-#### stdlib_ndarray_get_bool( \*arr, \*sub, \*out )
-
-Returns a boolean ndarray data element.
-
-```c
-int8_t stdlib_ndarray_get_bool( const struct ndarray *arr, const int64_t *sub, bool *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-- **out**: `[out] bool *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-
-* * *
-
-#### stdlib_ndarray_get_ptr( \*arr, \*sub )
-
-Returns a pointer to an ndarray data element in the underlying byte array.
-
-```c
-uint8_t * stdlib_ndarray_get_ptr( const struct ndarray *arr, const int64_t *sub );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **sub**: `[in] int64_t *` ndarray subscripts.
-
-#### stdlib_ndarray_get_ptr_value( \*arr, \*idx, \*out )
-
-Returns an ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_value( const struct ndarray *arr, const uint8_t *idx, void *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray *` input ndarray.
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] void *` output address.
-
-Notes:
-
-- The function does **not** perform bounds checking and **assumes** you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function requires a `void` pointer for the output address `out` in order to provide a generic API supporting ndarrays having different data types.
-
-#### stdlib_ndarray_get_ptr_float64( \*idx, \*out )
-
-Returns a double-precision floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_float64( const uint8_t *idx, double *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] double *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_float32( \*idx, \*out )
-
-Returns a single-precision floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_float32( const uint8_t *idx, float *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] float *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_uint64( \*idx, \*out )
-
-Returns an unsigned 64-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_uint64( const uint8_t *idx, uint64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] uint64_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_int64( \*idx, \*out )
-
-Returns a signed 64-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_int64( const uint8_t *idx, int64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] int64_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_uint32( \*idx, \*out )
-
-Returns an unsigned 32-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_uint32( const uint8_t *idx, uint32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] uint32_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_int32( \*idx, \*out )
-
-Returns a signed 32-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_int32( const uint8_t *idx, int32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] int32_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_uint16( \*idx, \*out )
-
-Returns an unsigned 16-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_uint16( const uint8_t *idx, uint16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] uint16_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_int16( \*idx, \*out )
-
-Returns a signed 16-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_int16( const uint8_t *idx, int16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] int16_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_uint8( \*idx, \*out )
-
-Returns an unsigned 8-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_uint8( const uint8_t *idx, uint8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] uint8_t *` output address.
-
-Notes:
-
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_int8( \*idx, \*out )
-
-Returns a signed 8-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_int8( const uint8_t *idx, int8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] int8_t *` output address.
-
-Notes:
-
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_complex128( \*idx, \*out )
-
-Returns a double-precision complex floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_complex128( const uint8_t *idx, stdlib_complex128_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] stdlib_complex128_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_complex64( \*idx, \*out )
-
-Returns a single-precision complex floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_complex64( const uint8_t *idx, stdlib_complex64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] stdlib_complex64_t *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_get_ptr_bool( \*idx, \*out )
-
-Returns a boolean ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_get_ptr_bool( const uint8_t *idx, bool *out );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t *` byte array pointer to an ndarray data element.
-- **out**: `[out] bool *` output address.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-* * *
-
-#### stdlib_ndarray_iget( \*arr, idx, \*out )
-
-Returns an ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget( const struct ndarray *arr, const int64_t idx, void *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] void *` output address.
-
-Notes:
-
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- The function requires a `void` pointer for the output address `out` in order to provide a generic API supporting ndarrays having different data types.
-- The function places the burden on the user to ensure that the output address is compatible with the data type of input ndarray data elements.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_float64( \*arr, idx, \*out )
-
-Returns a double-precision floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_float64( const struct ndarray *arr, const int64_t idx, double *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] double *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_float32( \*arr, idx, \*out )
-
-Returns a single-precision floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_float32( const struct ndarray *arr, const int64_t idx, float *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] float *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_uint64( \*arr, idx, \*out )
-
-Returns an unsigned 64-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_uint64( const struct ndarray *arr, const int64_t idx, uint64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] uint64_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_int64( \*arr, idx, \*out )
-
-Returns a signed 64-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_int64( const struct ndarray *arr, const int64_t idx, int64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] int64_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_uint32( \*arr, idx, \*out )
-
-Returns an unsigned 32-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_uint32( const struct ndarray *arr, const int64_t idx, uint32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] uint32_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_int32( \*arr, idx, \*out )
-
-Returns a signed 32-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_int32( const struct ndarray *arr, const int64_t idx, int32_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] int32_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_uint16( \*arr, idx, \*out )
-
-Returns an unsigned 16-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_uint16( const struct ndarray *arr, const int64_t idx, uint16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] uint16_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_int16( \*arr, idx, \*out )
-
-Returns a signed 16-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_int16( const struct ndarray *arr, const int64_t idx, int16_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] int16_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_uint8( \*arr, idx, \*out )
-
-Returns an unsigned 8-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_uint8( const struct ndarray *arr, const int64_t idx, uint8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] uint8_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_int8( \*arr, idx, \*out )
-
-Returns a signed 8-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_int8( const struct ndarray *arr, const int64_t idx, int8_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] int8_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_complex128( \*arr, idx, \*out )
-
-Returns a double-precision complex floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_complex128( const struct ndarray *arr, const int64_t idx, stdlib_complex128_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] stdlib_complex128_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_complex64( \*arr, idx, \*out )
-
-Returns a single-precision complex floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_complex64( const struct ndarray *arr, const int64_t idx, stdlib_complex64_t *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] stdlib_complex64_t *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iget_bool( \*arr, idx, \*out )
-
-Returns a boolean ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iget_bool( const struct ndarray *arr, const int64_t idx, bool *out );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **out**: `[out] bool *` output address.
-
-Notes:
-
-- The function does **not** verify that the output address type matches the underlying input ndarray data type and **assumes** that you know what you are doing.
-- The function returns `-1` if unable to get an element and `0` otherwise.
-- For zero-dimensional arrays, the function returns the first (and only) indexed element, regardless of the value of `idx`.
-
-* * *
-
-#### stdlib_ndarray_iget_ptr( \*arr, idx )
-
-Returns a pointer in the underlying byte array for an ndarray data element located at a specified linear index.
-
-```c
-uint8_t * stdlib_ndarray_iget_ptr( const struct ndarray *arr, const int64_t idx );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-
-For zero-dimensional arrays, the function returns a pointer to the first (and only) indexed element, regardless of the value of `idx`.
-
-* * *
-
-#### stdlib_ndarray_iset( \*arr, idx, \*v )
-
-Sets an ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset( const struct ndarray *arr, const int64_t idx, const void *v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] void*` value to set.
-
-Notes:
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- The function requires a pointer to a data value `v` in order to provide a generic API supporting ndarrays having different data types.
-- The function has no way of determining whether `v` actually points to a memory address compatible with the underlying input ndarray data type. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_float64( \*arr, idx, v )
-
-Sets a double-precision floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_float64( const struct ndarray *arr, const int64_t idx, const double v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] double` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_float32( \*arr, idx, v )
-
-Sets a single-precision floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_float32( const struct ndarray *arr, const int64_t idx, const float v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] float` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_uint64( \*arr, idx, v )
-
-Sets an unsigned 64-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_uint64( const struct ndarray *arr, const int64_t idx, const uint64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] uint64_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_int64( \*arr, idx, v )
-
-Sets a signed 64-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_int64( const struct ndarray *arr, const int64_t idx, const int64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] int64_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_uint32( \*arr, idx, v )
-
-Sets an unsigned 32-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_uint32( const struct ndarray *arr, const int64_t idx, const uint32_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] uint32_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_int32( \*arr, idx, v )
-
-Sets a signed 32-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_int32( const struct ndarray *arr, const int64_t idx, const int32_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] int32_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_uint16( \*arr, idx, v )
-
-Sets an unsigned 16-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_uint16( const struct ndarray *arr, const int64_t idx, const uint16_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] uint16_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_int16( \*arr, idx, v )
-
-Sets a signed 16-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_int16( const struct ndarray *arr, const int64_t idx, const int16_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] int16_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_uint8( \*arr, idx, v )
-
-Sets an unsigned 8-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_uint8( const struct ndarray *arr, const int64_t idx, const uint8_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] uint8_t` value to set.
-
-Notes:
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_int8( \*arr, idx, v )
-
-Sets a signed 8-bit integer ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_int8( const struct ndarray *arr, const int64_t idx, const int8_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] int8_t` value to set.
-
-Notes:
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_complex128( \*arr, idx, v )
-
-Sets a double-precision complex floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_complex128( const struct ndarray *arr, const int64_t idx, const stdlib_complex128_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] stdlib_complex128_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_complex64( \*arr, idx, v )
-
-Sets a single-precision complex floating-point ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_complex64( const struct ndarray *arr, const int64_t idx, const stdlib_complex64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] stdlib_complex64_t` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-#### stdlib_ndarray_iset_bool( \*arr, idx, v )
-
-Sets a boolean ndarray data element located at a specified linear index.
-
-```c
-int8_t stdlib_ndarray_iset_bool( const struct ndarray *arr, const int64_t idx, const bool v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] int64_t` linear view index.
-- **v**: `[in] bool` value to set.
-
-Notes:
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- For zero-dimensional arrays, the function sets the first (and only) indexed element, regardless of the value of `idx`.
-
-* * *
-
-#### stdlib_ndarray_set( \*arr, \*sub, \*v )
-
-Sets an ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set( const struct ndarray *arr, const int64_t *sub, const void *v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] void*` value to set.
-
-Notes
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- The function requires a pointer to a data value `v` in order to provide a generic API supporting ndarrays having different data types.
-- The function has no way of determining whether `v` actually points to a memory address compatible with the underlying input ndarray data type. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
-
-#### stdlib_ndarray_set_float64( \*arr, \*sub, v )
-
-Sets a double-precision floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_float64( const struct ndarray *arr, const int64_t *sub, const double v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] double` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_float32( \*arr, \*sub, v )
-
-Sets a single-precision floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_float32( const struct ndarray *arr, const int64_t *sub, const float v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] float` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_uint64( \*arr, \*sub, v )
-
-Sets an unsigned 64-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_uint64( const struct ndarray *arr, const int64_t *sub, const uint64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] uint64_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_int64( \*arr, \*sub, v )
-
-Sets a signed 64-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_int64( const struct ndarray *arr, const int64_t *sub, const int64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] int64_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_uint32( \*arr, \*sub, v )
-
-Sets an unsigned 32-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_uint32( const struct ndarray *arr, const int64_t *sub, const uint32_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] uint32_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_int32( \*arr, \*sub, v )
-
-Sets a signed 32-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_int32( const struct ndarray *arr, const int64_t *sub, const int32_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] int32_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_uint16( \*arr, \*sub, v )
-
-Sets an unsigned 16-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_uint16( const struct ndarray *arr, const int64_t *sub, const uint16_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] uint16_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_int16( \*arr, \*sub, v )
-
-Sets a signed 16-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_int16( const struct ndarray *arr, const int64_t *sub, const int16_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] int16_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_uint8( \*arr, \*sub, v )
-
-Sets an unsigned 8-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_uint8( const struct ndarray *arr, const int64_t *sub, const uint8_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] uint8_t` value to set.
-
-Notes
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_int8( \*arr, \*sub, v )
-
-Sets a signed 8-bit integer ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_int8( const struct ndarray *arr, const int64_t *sub, const int8_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] int8_t` value to set.
-
-Notes
-
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_complex128( \*arr, \*sub, v )
-
-Sets a double-precision complex floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_complex128( const struct ndarray *arr, const int64_t *sub, const stdlib_complex128_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] stdlib_complex128_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_complex64( \*arr, \*sub, v )
-
-Sets a single-precision complex floating-point ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_complex64( const struct ndarray *arr, const int64_t *sub, const stdlib_complex64_t v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] stdlib_complex64_t` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-#### stdlib_ndarray_set_bool( \*arr, \*sub, v )
-
-Sets a boolean ndarray data element.
-
-```c
-int8_t stdlib_ndarray_set_bool( const struct ndarray *arr, const int64_t *sub, const bool v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **sub**: `[in] int64_t*` ndarray subscripts.
-- **v**: `[in] bool` value to set.
-
-Notes
-
-- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-
-* * *
-
-#### stdlib_ndarray_set_ptr_value( \*arr, \*idx, \*v )
-
-Sets an ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_value( const struct ndarray *arr, uint8_t *idx, const void *v );
-```
-
-The function accepts the following arguments:
-
-- **arr**: `[in] struct ndarray*` input ndarray.
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] void*` value to set.
-
-Notes:
-
-- The function does **not** perform bounds checking, and, thus, the function does **not** prevent you from overwriting **unowned** memory. Accordingly, the function **assumes** you know what you are doing.
-- The function returns `-1` if unable to set an element and `0` otherwise.
-- The function requires a pointer to a data value `v` in order to provide a generic API supporting ndarrays having different data types.
-
-#### stdlib_ndarray_set_ptr_float64( \*idx, v )
-
-Sets a double-precision floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_float64( uint8_t *idx, const double v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] double` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_float32( \*idx, v )
-
-Sets a single-precision floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_float32( uint8_t *idx, const float v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] float` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_uint64( \*idx, v )
-
-Sets an unsigned 64-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_uint64( uint8_t *idx, const uint64_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] uint64_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_int64( \*idx, v )
-
-Sets a signed 64-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_int64( uint8_t *idx, const int64_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] int64_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_uint32( \*idx, v )
-
-Sets an unsigned 32-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_uint32( uint8_t *idx, const uint32_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] uint32_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_int32( \*idx, v )
-
-Sets a signed 32-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_int32( uint8_t *idx, const int32_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] int32_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_uint16( \*idx, v )
-
-Sets an unsigned 16-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_uint16( uint8_t *idx, const uint16_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] uint16_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_int16( \*idx, v )
-
-Sets a signed 16-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_int16( uint8_t *idx, const int16_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] int16_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_uint8( \*idx, v )
-
-Sets an unsigned 8-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_uint8( uint8_t *idx, const uint8_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] uint8_t` value to set.
-
-Notes:
-
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_int8( \*idx, v )
-
-Sets a signed 8-bit integer ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_int8( uint8_t *idx, const int8_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] int8_t` value to set.
-
-Notes:
-
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_complex128( \*idx, v )
-
-Sets a double-precision complex floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_complex128( uint8_t *idx, const stdlib_complex128_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] stdlib_complex128_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_complex64( \*idx, v )
-
-Sets a single-precision complex floating-point ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_complex64( uint8_t *idx, const stdlib_complex64_t v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] stdlib_complex64_t` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-#### stdlib_ndarray_set_ptr_bool( \*idx, v )
-
-Sets a boolean ndarray data element specified by a byte array pointer.
-
-```c
-int8_t stdlib_ndarray_set_ptr_bool( uint8_t *idx, const bool v );
-```
-
-The function accepts the following arguments:
-
-- **idx**: `[in] uint8_t*` byte array pointer to an ndarray data element.
-- **v**: `[in] bool` value to set.
-
-Notes:
-
-- The function has no way of determining whether `idx` actually points to a compatible memory address. Accordingly, overwriting **unowned** memory is possible, and this function **assumes** you know what you are doing.
-- The function always returns `0`.
-
-
-
-
-
-
-
-
-
-
-
-
-
-* * *
-
-
-
-### Examples
-
-```c
-#include "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/dtypes.h"
-#include "stdlib/ndarray/index_modes.h"
-#include "stdlib/ndarray/orders.h"
-#include "stdlib/ndarray/base/bytes_per_element.h"
-#include "stdlib/ndarray/base/dtype_char.h"
-#include
-#include
-#include
-#include
-
-void print_ndarray_contents( const struct ndarray *x ) {
- int64_t i;
- double v;
- int8_t s;
-
- for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) {
- s = stdlib_ndarray_iget_float64( x, i, &v ); // WARNING: assumes `x->dtype` is float64
- if ( s != 0 ) {
- printf( "Unable to resolve data element.\n" );
- exit( 1 );
- }
- printf( "data[%"PRId64"] = %f\n", i, v );
- }
-}
-
-int main( void ) {
- // Manually create an ndarray (WARNING: this is for illustration purposes only, as the fields of an ndarray are subject to change; for ABI compatibility, use utility functions for accessing ndarray data)...
- struct ndarray *x1 = malloc( sizeof( struct ndarray ) );
- if ( x1 == NULL ) {
- printf( "Error allocating memory.\n" );
- exit( 1 );
- }
-
- // Specify the underlying data type:
- enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT64;
- x1->dtype = dtype;
-
- // Create an underlying byte array:
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- x1->data = buffer;
-
- // Explicitly specify the number of bytes per element:
- x1->BYTES_PER_ELEMENT = STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT;
-
- // Specify the array shape:
- int64_t shape[] = { 3 }; // vector consisting of 3 doubles
- x1->shape = shape;
-
- // Specify the array strides:
- int64_t strides[] = { x1->BYTES_PER_ELEMENT };
- x1->strides = strides;
-
- // Specify the byte offset:
- x1->offset = 0;
-
- // Specify the array order (note: this does not matter for a 1-dimensional array):
- enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
- x1->order = order;
-
- // Specify the index mode:
- enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
- x1->imode = imode;
-
- // Specify the subscript index modes:
- int8_t submodes[] = { imode };
- x1->submodes = submodes;
- x1->nsubmodes = 1;
-
- // Explicitly specify the number of array dimensions:
- x1->ndims = 1; // vector
-
- // Explicitly specify the number of array elements (doubles):
- x1->length = x1->shape[ 0 ];
-
- // Explicitly specify the number of bytes:
- x1->byteLength = (x1->length) * (x1->BYTES_PER_ELEMENT);
-
- // Explicitly set the array flags:
- x1->flags = stdlib_ndarray_flags( x1 );
-
- printf( "dtype = %u\n", stdlib_ndarray_dtype( x1 ) );
- printf( "length = %"PRId64"\n", stdlib_ndarray_length( x1 ) );
- printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x1 ) );
- printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x1 ) ) );
- printf( "\n" );
-
- // Use the function interface to create an ndarray (NOTE: for future ABI compatibility, using the following function interface should be preferred)...
- struct ndarray *x2 = stdlib_ndarray_allocate( dtype, buffer, 1, shape, strides, 0, order, imode, 1, submodes );
- if ( x2 == NULL ) {
- printf( "Error allocating memory.\n" );
- exit( 1 );
- }
-
- printf( "dtype = %u\n", stdlib_ndarray_dtype( x2 ) );
- printf( "length = %"PRId64"\n", stdlib_ndarray_length( x2 ) );
- printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x2 ) );
- printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x2 ) ) );
- printf( "\n" );
-
- // Set values in the underlying byte array using pointers:
- int64_t sub[] = { 0 };
- uint8_t *ptr = stdlib_ndarray_get_ptr( x2, sub );
- if ( ptr == NULL ) {
- printf( "Unable to resolve data pointer.\n" );
- exit( 1 );
- }
- *(double *)ptr = 1.0;
-
- sub[ 0 ] = 1;
- ptr = stdlib_ndarray_get_ptr( x2, sub );
- if ( ptr == NULL ) {
- printf( "Unable to resolve data pointer.\n" );
- exit( 1 );
- }
- *(double *)ptr = 2.0;
-
- sub[ 0 ] = 2;
- ptr = stdlib_ndarray_get_ptr( x2, sub );
- if ( ptr == NULL ) {
- printf( "Unable to resolve data pointer.\n" );
- exit( 1 );
- }
- *(double *)ptr = 3.0;
-
- // Print out the current ndarray elements:
- print_ndarray_contents( x2 );
- printf( "\n" );
-
- // Set values in the underlying byte array using a "generic" function:
- sub[ 0 ] = 0;
- double v = 4.0;
- int8_t status = stdlib_ndarray_set( x2, sub, (void *)&v );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 1;
- v = 5.0;
- status = stdlib_ndarray_set( x2, sub, (void *)&v );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 2;
- v = 6.0;
- status = stdlib_ndarray_set( x2, sub, (void *)&v );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- // Print out the current ndarray elements:
- print_ndarray_contents( x2 );
- printf( "\n" );
-
- // Set values in the underlying byte array using a specialized function:
- sub[ 0 ] = 0;
- status = stdlib_ndarray_set_float64( x2, sub, 7.0 );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 1;
- status = stdlib_ndarray_set_float64( x2, sub, 8.0 );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 2;
- status = stdlib_ndarray_set_float64( x2, sub, 9.0 );
- if ( status != 0 ) {
- printf( "Unable to set data element.\n" );
- exit( 1 );
- }
-
- // Print out the current ndarray elements:
- print_ndarray_contents( x2 );
- printf( "\n" );
-
- // Free allocated memory:
- stdlib_ndarray_free( x1 );
- stdlib_ndarray_free( x2 );
-}
-```
-
-
-
-
-
-
-
@@ -3660,17 +841,17 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].
[json]: http://www.json.org/
-[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes
+[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/umd
-[@stdlib/ndarray/orders]: https://github.com/stdlib-js/ndarray-orders
+[@stdlib/ndarray/orders]: https://github.com/stdlib-js/ndarray-orders/tree/umd
-[@stdlib/ndarray/index-modes]: https://github.com/stdlib-js/ndarray-index-modes
+[@stdlib/ndarray/index-modes]: https://github.com/stdlib-js/ndarray-index-modes/tree/umd
-[@stdlib/ndarray/array]: https://github.com/stdlib-js/ndarray-array
+[@stdlib/ndarray/array]: https://github.com/stdlib-js/ndarray-array/tree/umd
-[@stdlib/ndarray/fancy]: https://github.com/stdlib-js/ndarray-fancy
+[@stdlib/ndarray/fancy]: https://github.com/stdlib-js/ndarray-fancy/tree/umd
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.attributes.js b/benchmark/benchmark.attributes.js
deleted file mode 100644
index 2a6431a..0000000
--- a/benchmark/benchmark.attributes.js
+++ /dev/null
@@ -1,655 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::get:byteLength', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.byteLength;
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- }
- b.toc();
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_byteLength', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._byteLength; // eslint-disable-line no-underscore-dangle
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- }
- b.toc();
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.BYTES_PER_ELEMENT;
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- }
- b.toc();
- if ( v !== null ) {
- b.fail( 'should return null' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:data', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.data;
- if ( v.length !== 6 ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== 6 ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_buffer', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._buffer; // eslint-disable-line no-underscore-dangle
- if ( v.length !== 6 ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== 6 ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:dtype', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.dtype;
- if ( v !== 'generic' ) {
- b.fail( 'should return expected data type' );
- }
- }
- b.toc();
- if ( v !== 'generic' ) {
- b.fail( 'should return expected data type' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:flags', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.flags;
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_flags', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._flags; // eslint-disable-line no-underscore-dangle
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:length', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.length;
- if ( v !== buffer.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v !== buffer.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_length', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._length; // eslint-disable-line no-underscore-dangle
- if ( v !== buffer.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v !== buffer.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:ndims', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.ndims;
- if ( v !== shape.length ) {
- b.fail( 'should return expected number of dimensions' );
- }
- }
- b.toc();
- if ( v !== shape.length ) {
- b.fail( 'should return expected number of dimensions' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:offset', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.offset;
- if ( v !== offset ) {
- b.fail( 'should return expected offset' );
- }
- }
- b.toc();
- if ( v !== offset ) {
- b.fail( 'should return expected offset' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_offset', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._offset; // eslint-disable-line no-underscore-dangle
- if ( v !== offset ) {
- b.fail( 'should return expected offset' );
- }
- }
- b.toc();
- if ( v !== offset ) {
- b.fail( 'should return expected offset' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:order', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.order;
- if ( v !== order ) {
- b.fail( 'should return expected order' );
- }
- }
- b.toc();
- if ( v !== order ) {
- b.fail( 'should return expected order' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_order', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._order; // eslint-disable-line no-underscore-dangle
- if ( v !== order ) {
- b.fail( 'should return expected order' );
- }
- }
- b.toc();
- if ( v !== order ) {
- b.fail( 'should return expected order' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:shape', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.shape;
- if ( v.length !== shape.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== shape.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_shape', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._shape; // eslint-disable-line no-underscore-dangle
- if ( v.length !== shape.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== shape.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:strides', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out.strides;
- if ( v.length !== strides.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== strides.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::get:_strides', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = out._strides; // eslint-disable-line no-underscore-dangle
- if ( v.length !== strides.length ) {
- b.fail( 'should return expected length' );
- }
- }
- b.toc();
- if ( v.length !== strides.length ) {
- b.fail( 'should return expected length' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.get.js b/benchmark/benchmark.get.js
deleted file mode 100644
index d198ce4..0000000
--- a/benchmark/benchmark.get.js
+++ /dev/null
@@ -1,783 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::1d:get', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:get:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%20)-10 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:get:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%20)-10 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:get:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%12)-6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:get', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( i%3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:get:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:get:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:get:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( (i%6)-3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:get', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, i%3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:get:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:get:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:get:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, (i%6)-3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:get', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, i%3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:get:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:get:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:get:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, (i%6)-3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:get', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, 0, i%3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:get:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:get:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, 0, (i%30)-15, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:get:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.get( 0, 0, 0, (i%6)-3, 1 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.iget.js b/benchmark/benchmark.iget.js
deleted file mode 100644
index edcd737..0000000
--- a/benchmark/benchmark.iget.js
+++ /dev/null
@@ -1,383 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::1d:iget', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iget:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iget:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iget:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var v;
- var i;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( (i%12)-6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_positive_strides:iget:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_positive_strides:iget:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_negative_strides:iget:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, -1 ];
- offset = 5;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_negative_strides:iget:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, -1 ];
- offset = 5;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,mixed_sign_strides:iget:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, 1 ];
- offset = 4;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,mixed_sign_strides:iget:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, 1 ];
- offset = 4;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.iget( i%6 );
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( v !== v ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.instantiation.js b/benchmark/benchmark.instantiation.js
deleted file mode 100644
index 32c7532..0000000
--- a/benchmark/benchmark.instantiation.js
+++ /dev/null
@@ -1,338 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::1d,instantiation', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d,instantiation,new', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = new ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,instantiation', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,instantiation,new', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = new ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d,instantiation', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d,instantiation,new', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = new ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d,instantiation', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d,instantiation,new', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = new ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d,instantiation', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d,instantiation,new', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 0 ] = i;
- out = new ndarray( 'generic', buffer, shape, strides, offset, order );
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- }
- b.toc();
- if ( out.length === 0 ) {
- b.fail( 'should have a length greater than 0' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.iset.js b/benchmark/benchmark.iset.js
deleted file mode 100644
index 9f2f492..0000000
--- a/benchmark/benchmark.iset.js
+++ /dev/null
@@ -1,406 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::1d:iset', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iset:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.iset( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.iget( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iset:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.iset( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.iget( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:iset:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%12) - 6;
- tmp = out.iset( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.iget( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_positive_strides:iset:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_positive_strides:iset:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_negative_strides:iset:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, -1 ];
- offset = 5;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ 5-j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ 5-j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,all_negative_strides:iset:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, -1 ];
- offset = 5;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ 5-j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ 5-j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,mixed_sign_strides:iset:order=row-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, 1 ];
- offset = 4;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ 0 ] !== buffer[ 0 ] ) {
- b.fail( 'should not be NaN' );
- }
- }
- b.toc();
- if ( out.iget( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d,mixed_sign_strides:iset:order=column-major', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ -2, 1 ];
- offset = 4;
- order = 'column-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.iset( j, v );
- if ( buffer[ 0 ] !== buffer[ 0 ] ) {
- b.fail( 'should not be NaN' );
- }
- }
- b.toc();
- if ( out.iget( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js
deleted file mode 100644
index 6e37d2e..0000000
--- a/benchmark/benchmark.set.js
+++ /dev/null
@@ -1,838 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+'::1d:set', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 6;
- out.set( j, v );
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ j ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:set:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%20) - 10;
- tmp = out.set( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:set:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%20) - 10;
- tmp = out.set( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::1d:set:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 6 ];
- strides = [ 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%12) - 6;
- tmp = out.set( j, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:set', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 3;
- out.set( j, 1, v );
- if ( buffer[ (2*j) + (1*1) ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ (2*j) + 1 ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:set:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:set:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::2d:set:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%6) - 3;
- tmp = out.set( j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:set', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 3;
- out.set( 0, j, 1, v );
- if ( buffer[ (2*j) + (1*1) ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ (2*j) + 1 ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:set:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:set:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::3d:set:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 3, 2 ];
- strides = [ 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%6) - 3;
- tmp = out.set( 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:set', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 3;
- out.set( 0, 0, j, 1, v );
- if ( buffer[ (2*j) + (1*1) ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ (2*j) + 1 ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:set:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:set:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::4d:set:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 3, 2 ];
- strides = [ 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%6) - 3;
- tmp = out.set( 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:set', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
- var j;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = i % 3;
- out.set( 0, 0, 0, j, 1, v );
- if ( buffer[ (2*j) + (1*1) ] !== v ) {
- b.fail( 'should set value' );
- }
- }
- b.toc();
- if ( buffer[ (2*j) + 1 ] !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:set:mode=wrap', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'wrap'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:set:mode=clamp', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'clamp'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%30) - 15;
- tmp = out.set( 0, 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+'::5d:set:mode=normalize', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var opts;
- var out;
- var tmp;
- var v;
- var i;
- var j;
-
- opts = {
- 'mode': 'normalize'
- };
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 1, 1, 1, 3, 2 ];
- strides = [ 6, 6, 6, 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order, opts );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = i;
- j = (i%6) - 3;
- tmp = out.set( 0, 0, 0, j, 1, v );
- if ( typeof tmp !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( out.get( 0, 0, 0, j, 1 ) !== v ) {
- b.fail( 'should set value' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.to_json.js b/benchmark/benchmark.to_json.js
deleted file mode 100644
index 747482b..0000000
--- a/benchmark/benchmark.to_json.js
+++ /dev/null
@@ -1,62 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+':toJSON', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.toJSON();
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an object' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js
deleted file mode 100644
index 798733e..0000000
--- a/benchmark/benchmark.to_string.js
+++ /dev/null
@@ -1,62 +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 pkg = require( './../package.json' ).name;
-var ndarray = require( './../lib' );
-
-
-// MAIN //
-
-bench( pkg+':toString', function benchmark( b ) {
- var strides;
- var buffer;
- var offset;
- var shape;
- var order;
- var out;
- var v;
- var i;
-
- buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
- shape = [ 3, 2 ];
- strides = [ 2, 1 ];
- offset = 0;
- order = 'row-major';
-
- out = ndarray( 'generic', buffer, shape, strides, offset, order );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- buffer[ 1 ] = i;
- v = out.toString();
- if ( typeof v !== 'string' ) {
- b.fail( 'should return a string' );
- }
- }
- b.toc();
- if ( typeof v !== 'string' ) {
- b.fail( 'should return a string' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/benchmark/c/Makefile b/benchmark/c/Makefile
deleted file mode 100644
index c12ea19..0000000
--- a/benchmark/c/Makefile
+++ /dev/null
@@ -1,146 +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.
-#/
-
-# 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 C source files.
-#
-# @param {string} SOURCE_FILES - list of C source files
-# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop`)
-# @param {string} [LIBRARIES] - list of libraries (e.g., `-lpthread -lblas`)
-# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
-# @param {string} [C_COMPILER] - C compiler
-# @param {string} [CFLAGS] - C compiler flags
-# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code
-#
-# @example
-# make
-#
-# @example
-# make all
-#/
-all: $(c_targets)
-
-.PHONY: all
-
-#/
-# Compiles C source files.
-#
-# @private
-# @param {string} SOURCE_FILES - list of C source files
-# @param {(string|void)} INCLUDE - list of includes (e.g., `-I /foo/bar -I /beep/boop`)
-# @param {(string|void)} LIBRARIES - list of libraries (e.g., `-lpthread -lblas`)
-# @param {(string|void)} LIBPATH - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
-# @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) $(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/benchmark.c b/benchmark/c/benchmark.c
deleted file mode 100644
index d9f6eb6..0000000
--- a/benchmark/c/benchmark.c
+++ /dev/null
@@ -1,3640 +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 "stdlib/ndarray/ctor.h"
-#include "stdlib/ndarray/dtypes.h"
-#include "stdlib/ndarray/index_modes.h"
-#include "stdlib/ndarray/orders.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define NAME "ndarray"
-#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 benchmark1( void ) {
- double elapsed;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL || arr->ndims != 2 ) {
- printf( "unexpected result\n" );
- break;
- }
- if ( i < ITERATIONS-1 ) {
- stdlib_ndarray_free( arr );
- }
- }
- elapsed = tic() - t;
-
- if ( arr == NULL || arr->ndims != 2 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark2( void ) {
- double elapsed;
- int64_t v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_bytelength( arr );
- if ( v != 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark3( void ) {
- double elapsed;
- uint8_t *v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- buffer[ 0 ] = i % 255; // cppcheck-suppress unreadVariable
- v = stdlib_ndarray_data( arr );
- if ( v[ 0 ] != (i%255) ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v[ 0 ] != ((i-1)%255) ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark4( void ) {
- enum STDLIB_NDARRAY_DTYPE v;
- double elapsed;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_dtype( arr );
- if ( v != STDLIB_NDARRAY_UINT8 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != STDLIB_NDARRAY_UINT8 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark5( void ) {
- double elapsed;
- int64_t v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- v = stdlib_ndarray_flags( arr );
- if ( v < 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v < 0 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark6( void ) {
- double elapsed;
- int64_t v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_length( arr );
- if ( v != (arr->length) ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != (arr->length) ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark7( void ) {
- double elapsed;
- int64_t v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_ndims( arr );
- if ( v != ndims ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != ndims ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark8( void ) {
- double elapsed;
- int64_t v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_offset( arr );
- if ( v != offset ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != offset ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark9( void ) {
- enum STDLIB_NDARRAY_ORDER v;
- double elapsed;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_order( arr );
- if ( v != STDLIB_NDARRAY_ROW_MAJOR ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != STDLIB_NDARRAY_ROW_MAJOR ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark10( void ) {
- double elapsed;
- int64_t *v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_shape( arr );
- if ( v[ 0 ] != shape[ 0 ] || v[ 1 ] != shape[ 1 ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v[ 0 ] != shape[ 0 ] || v[ 1 ] != shape[ 1 ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark11( void ) {
- double elapsed;
- int64_t *v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_strides( arr );
- if ( v[ 0 ] != strides[ 0 ] || v[ 1 ] != strides[ 1 ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v[ 0 ] != strides[ 0 ] || v[ 1 ] != strides[ 1 ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark12( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( rand_double()*shape[0] );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v != buffer[ sub[0] ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v != buffer[ sub[0] ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark13( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*20.0)-10.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark14( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*20.0)-10.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- } else if ( sub[0] < 0 && v != buffer[ 0 ] ) {
- printf( "unexpected result when negative subscript: %u != %u\n", buffer[ 0 ], v );
- } else if ( sub[0] >= shape[0] && v != buffer[ shape[0]-1 ] ) {
- printf( "unexpected result when subscript exceeds dimensions: %u != %u\n", buffer[ shape[0]-1 ], v );
- } else if ( sub[0] >= 0 && sub[0] < shape[0] && v != buffer[ sub[0] ] ) {
- printf( "unexpected result for normal subscript: %u != %u\n", buffer[ sub[0] ], v );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark15( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( rand_double()*shape[0] );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark16( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark17( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark18( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( (rand_double()*shape[1])-0.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark19( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark20( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark21( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( (rand_double()*shape[2])-0.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark22( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark23( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark24( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( (rand_double()*shape[3])-0.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark25( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark26( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_get( arr, sub, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark27( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*shape[0])-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark28( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result: idx=%"PRId64", v=%u\n", idx, v );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark29( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*30.0)-15.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark30( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark31( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 1, 3 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark32( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark33( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -1, -3 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark34( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, 1 };
- int64_t offset = 4;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark35( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 1, -3 };
- int64_t offset = 3;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- s = stdlib_ndarray_iget( arr, idx, (void *)&v );
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || v > 6 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark36( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( rand_double()*shape[0] );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 || buffer[ sub[0] ] != v ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || buffer[ sub[0] ] != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark37( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark38( void ) {
- double elapsed;
- int64_t sub[1];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- } else if ( sub[0] < 0 && buffer[ 0 ] != v ) {
- printf( "unexpected result when negative subscript: %u != %u\n", buffer[ 0 ], v );
- } else if ( sub[0] >= shape[0] && buffer[ shape[0]-1 ] != v ) {
- printf( "unexpected result when subscript exceeds dimensions: %u != %u\n", buffer[ shape[0]-1 ], v );
- } else if ( sub[0] >= 0 && sub[0] < shape[0] && buffer[ sub[0] ] != v ) {
- printf( "unexpected result for normal subscript: %u != %u\n", buffer[ sub[0] ], v );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark39( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( rand_double()*shape[0] );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark40( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark41( void ) {
- double elapsed;
- int64_t sub[2];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 1 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 0 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark42( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( rand_double()*shape[1] );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark43( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark44( void ) {
- double elapsed;
- int64_t sub[3];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 3;
- int64_t shape[] = { 1, 3, 2 };
- int64_t strides[] = { 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 2 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 1 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark45( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( rand_double()*shape[2] );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark46( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark47( void ) {
- double elapsed;
- int64_t sub[4];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 4;
- int64_t shape[] = { 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 3 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 2 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark48( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( rand_double()*shape[3] );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark49( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark50( void ) {
- double elapsed;
- int64_t sub[5];
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 5;
- int64_t shape[] = { 1, 1, 1, 3, 2 };
- int64_t strides[] = { 6, 6, 6, 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- sub[ 0 ] = 0;
- sub[ 1 ] = 0;
- sub[ 2 ] = 0;
- sub[ 4 ] = 1;
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- sub[ 3 ] = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_set( arr, sub, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_get_ptr( arr, sub )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark51( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*shape[0])-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 || buffer[ idx ] != v ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || buffer[ idx ] != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark52( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_WRAP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx)) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark53( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 1;
- int64_t shape[] = { 6 };
- int64_t strides[] = { 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_CLAMP;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*30.0)-15.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- } else if ( idx < 0 && buffer[ 0 ] != v ) {
- printf( "unexpected result when negative linear index: %u != %u\n", buffer[ 0 ], v );
- } else if ( idx >= shape[0] && buffer[ shape[0]-1 ] != v ) {
- printf( "unexpected result when linear index exceeds dimensions: %u != %u\n", buffer[ shape[0]-1 ], v );
- } else if ( idx >= 0 && idx < shape[0] && buffer[ idx ] != v ) {
- printf( "unexpected result for normal linear index: %u != %u\n", buffer[ idx ], v );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark54( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark55( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 1, 3 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark56( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx)) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark57( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -1, -3 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark58( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, 1 };
- int64_t offset = 4;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark59( void ) {
- double elapsed;
- int64_t idx;
- uint8_t v;
- double t;
- int8_t s;
- int i;
-
- uint8_t buffer[] = { 1, 2, 3, 4, 5, 6 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 1, -3 };
- int64_t offset = 3;
- int64_t nsubmodes = 1;
- enum STDLIB_NDARRAY_INDEX_MODE mode = STDLIB_NDARRAY_INDEX_ERROR;
- int8_t submodes[] = { mode };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_COLUMN_MAJOR, mode, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- idx = (int64_t)( (rand_double()*6.0)-0.0 );
- v = (uint8_t)( rand_double()*255.0 );
- s = stdlib_ndarray_iset( arr, idx, (void *)&v );
- if ( s != 0 ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( s != 0 || *(stdlib_ndarray_iget_ptr( arr, idx )) != v ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark60( void ) {
- double elapsed;
- int64_t v;
- int64_t j;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- j = (int64_t)( rand_double()*ndims );
- v = stdlib_ndarray_dimension( arr, j );
- if ( v != shape[ j ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != shape[ j ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark61( void ) {
- double elapsed;
- int64_t v;
- int64_t j;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- j = (int64_t)( rand_double()*ndims );
- v = stdlib_ndarray_stride( arr, j );
- if ( v != strides[ j ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != strides[ j ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark62( void ) {
- enum STDLIB_NDARRAY_INDEX_MODE v;
- double elapsed;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_index_mode( arr );
- if ( v != STDLIB_NDARRAY_INDEX_ERROR ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != STDLIB_NDARRAY_INDEX_ERROR ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark63( void ) {
- double elapsed;
- int8_t *v;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { 2, 1 };
- int64_t offset = 0;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- // NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
- v = stdlib_ndarray_submodes( arr );
- if ( v[ 0 ] != submodes[ 0 ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v[ 0 ] != submodes[ 0 ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Runs a benchmark.
-*
-* @return elapsed time in seconds
-*/
-static double benchmark64( void ) {
- enum STDLIB_NDARRAY_INDEX_MODE v;
- double elapsed;
- int64_t j;
- double t;
- int i;
-
- uint8_t buffer[] = { 0, 0, 0, 0, 0, 0 };
- int64_t ndims = 2;
- int64_t shape[] = { 3, 2 };
- int64_t strides[] = { -2, -1 };
- int64_t offset = 5;
- int64_t nsubmodes = 1;
- int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
-
- struct ndarray *arr = stdlib_ndarray_allocate( STDLIB_NDARRAY_UINT8, buffer, ndims, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, nsubmodes, submodes );
- if ( arr == NULL ) {
- printf( "unable to allocate memory\n" );
- exit( 1 );
- }
-
- t = tic();
- for ( i = 0; i < ITERATIONS; i++ ) {
- j = (int64_t)( rand_double()*ndims );
- v = stdlib_ndarray_submode( arr, j );
- if ( v != submodes[ 0 ] ) {
- printf( "unexpected result\n" );
- break;
- }
- }
- elapsed = tic() - t;
-
- if ( v != submodes[ 0 ] ) {
- printf( "unexpected result\n" );
- }
- stdlib_ndarray_free( arr );
-
- return elapsed;
-}
-
-/**
-* Main execution sequence.
-*/
-int main( void ) {
- double elapsed;
- int count;
- int i;
-
- count = 0;
-
- // Use the current time to seed the random number generator:
- srand( time( NULL ) );
-
- print_version();
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::instantiation\n", NAME );
- elapsed = benchmark1();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:byteLength\n", NAME );
- elapsed = benchmark2();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:data\n", NAME );
- elapsed = benchmark3();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:dtype\n", NAME );
- elapsed = benchmark4();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:flags\n", NAME );
- elapsed = benchmark5();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:length\n", NAME );
- elapsed = benchmark6();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:ndims\n", NAME );
- elapsed = benchmark7();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:offset\n", NAME );
- elapsed = benchmark8();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:order\n", NAME );
- elapsed = benchmark9();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:shape\n", NAME );
- elapsed = benchmark10();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:strides\n", NAME );
- elapsed = benchmark11();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:get:mode=error\n", NAME );
- elapsed = benchmark12();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:get:mode=wrap\n", NAME );
- elapsed = benchmark13();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:get:mode=clamp\n", NAME );
- elapsed = benchmark14();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:get:mode=error\n", NAME );
- elapsed = benchmark15();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:get:mode=wrap\n", NAME );
- elapsed = benchmark16();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:get:mode=clamp\n", NAME );
- elapsed = benchmark17();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:get:mode=error\n", NAME );
- elapsed = benchmark18();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:get:mode=wrap\n", NAME );
- elapsed = benchmark19();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:get:mode=clamp\n", NAME );
- elapsed = benchmark20();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:get:mode=error\n", NAME );
- elapsed = benchmark21();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:get:mode=wrap\n", NAME );
- elapsed = benchmark22();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:get:mode=clamp\n", NAME );
- elapsed = benchmark23();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:get:mode=error\n", NAME );
- elapsed = benchmark24();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:get:mode=wrap\n", NAME );
- elapsed = benchmark25();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:get:mode=clamp\n", NAME );
- elapsed = benchmark26();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iget:mode=error\n", NAME );
- elapsed = benchmark27();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iget:mode=wrap\n", NAME );
- elapsed = benchmark28();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iget:mode=clamp\n", NAME );
- elapsed = benchmark29();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_positive_strides:iget:mode=error,order=row-major\n", NAME );
- elapsed = benchmark30();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_positive_strides:iget:mode=error,order=column-major\n", NAME );
- elapsed = benchmark31();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_negative_strides:iget:mode=error,order=row-major\n", NAME );
- elapsed = benchmark32();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_negative_strides:iget:mode=error,order=column-major\n", NAME );
- elapsed = benchmark33();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,mixed_sign_strides:iget:mode=error,order=row-major\n", NAME );
- elapsed = benchmark34();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,mixed_sign_strides:iget:mode=error,order=column-major\n", NAME );
- elapsed = benchmark35();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:set:mode=error\n", NAME );
- elapsed = benchmark36();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:set:mode=wrap\n", NAME );
- elapsed = benchmark37();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:set:mode=clamp\n", NAME );
- elapsed = benchmark38();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:set:mode=error\n", NAME );
- elapsed = benchmark39();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:set:mode=wrap\n", NAME );
- elapsed = benchmark40();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d:set:mode=clamp\n", NAME );
- elapsed = benchmark41();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:set:mode=error\n", NAME );
- elapsed = benchmark42();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:set:mode=wrap\n", NAME );
- elapsed = benchmark43();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::3d:set:mode=clamp\n", NAME );
- elapsed = benchmark44();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:set:mode=error\n", NAME );
- elapsed = benchmark45();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:set:mode=wrap\n", NAME );
- elapsed = benchmark46();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::4d:set:mode=clamp\n", NAME );
- elapsed = benchmark47();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:set:mode=error\n", NAME );
- elapsed = benchmark48();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:set:mode=wrap\n", NAME );
- elapsed = benchmark49();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::5d:set:mode=clamp\n", NAME );
- elapsed = benchmark50();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iset:mode=error\n", NAME );
- elapsed = benchmark51();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iset:mode=wrap\n", NAME );
- elapsed = benchmark52();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::1d:iset:mode=clamp\n", NAME );
- elapsed = benchmark53();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_positive_strides:iset:mode=error,order=row-major\n", NAME );
- elapsed = benchmark54();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_positive_strides:iset:mode=error,order=column-major\n", NAME );
- elapsed = benchmark55();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_negative_strides:iset:mode=error,order=row-major\n", NAME );
- elapsed = benchmark56();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,all_negative_strides:iset:mode=error,order=column-major\n", NAME );
- elapsed = benchmark57();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,mixed_sign_strides:iset:mode=error,order=row-major\n", NAME );
- elapsed = benchmark58();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::2d,mixed_sign_strides:iset:mode=error,order=column-major\n", NAME );
- elapsed = benchmark59();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:dimension\n", NAME );
- elapsed = benchmark60();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:stride\n", NAME );
- elapsed = benchmark61();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:index_mode\n", NAME );
- elapsed = benchmark62();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:submodes\n", NAME );
- elapsed = benchmark63();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- for ( i = 0; i < REPEATS; i++ ) {
- count += 1;
- printf( "# c::native::%s::get:submode\n", NAME );
- elapsed = benchmark64();
- print_results( elapsed );
- printf( "ok %d benchmark finished\n", count );
- }
- print_summary( count, count );
-}
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 4ae2dc7..0000000
--- a/benchmark/julia/benchmark.jl
+++ /dev/null
@@ -1,342 +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:
-repeats = 3;
-samples = 1e4;
-count = 0;
-
-"""
- 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( setup, expr )
-
-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.
-
-# Arguments
-
-* `setup`: setup expression
-* `expr`: expression to benchmark
-
-# Examples
-
-``` julia
-julia> out = benchmark( :(), :( sin( 3.14 ) ) );
-```
-"""
-function benchmark( setup, expr )
- t = eval( :( BenchmarkTools.@benchmark $expr samples=$samples setup=($setup) ) )
-
- # 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
-
-"""
- bench( name, setup, expr )
-
-Run a named benchmark.
-
-# Arguments
-
-* `name`: benchmark name (suffix)
-* `setup`: setup expression
-* `expr`: expression to benchmark
-
-# Examples
-
-``` julia
-julia> bench( "sin", :(), :( sin( 3.14 ) ) );
-```
-"""
-function bench( name, setup, expr )
- for i in 1:repeats
- @printf( "# julia::%s\n", name );
- global count += 1;
- results = benchmark( setup, expr );
- print_results( results[ 1 ], results[ 2 ] );
- @printf( "ok %d benchmark finished\n", count );
- end
-end
-
-"""
- main()
-
-Run benchmarks.
-
-# Examples
-
-``` julia
-julia> main();
-```
-"""
-function main()
- print_version();
-
- name = "ndarray::instantiation";
- setup = :();
- stmt = :( A = Array{Float64}( undef, 3, 2 ) );
- bench( name, setup, stmt );
-
- name = "ndarray::get::dtype";
- setup = :( A = Array{Float64}( undef, 3, 2 ) );
- stmt = quote
- d = eltype( A );
- if d != Float64
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::get::length";
- setup = :( A = Array{Float64}( undef, 3, 2 ) );
- stmt = quote
- N = length( A );
- if N != 6
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::get::ndims";
- setup = :( A = Array{Float64}( undef, 3, 2 ) );
- stmt = quote
- M = ndims( A );
- if M != 2
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::get::shape";
- setup = :( A = Array{Float64}( undef, 3, 2 ) );
- stmt = quote
- shape = size( A );
- if shape[ 1 ] != 3
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::get::strides";
- setup = :( A = Array{Float64}( undef, 3, 2 ) );
- stmt = quote
- s = strides( A );
- if s[ 1 ] != 1
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::1d:get";
- setup = :( A = rand( Float64, 6 ) );
- stmt = quote
- j = Int( floor( rand()*6.0 ) ) + 1;
- v = A[ j ];
- if v != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::2d:get";
- setup = :( A = rand( Float64, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = A[ j, 2 ];
- if v != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::3d:get";
- setup = :( A = rand( Float64, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = A[ 1, j, 2 ];
- if v != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::4d:get";
- setup = :( A = rand( Float64, 1, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = A[ 1, 1, j, 2 ];
- if v != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::5d:get";
- setup = :( A = rand( Float64, 1, 1, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = A[ 1, 1, 1, j, 2 ];
- if v != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::1d:set";
- setup = :( A = rand( Float64, 6 ) );
- stmt = quote
- j = Int( floor( rand()*6.0 ) ) + 1;
- v = rand();
- A[ j ] = v;
- if A[ j ] != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::2d:set";
- setup = :( A = rand( Float64, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = rand();
- A[ j, 2 ] = v;
- if A[ j, 2 ] != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::3d:set";
- setup = :( A = rand( Float64, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = rand();
- A[ 1, j, 2 ] = v;
- if A[ 1, j, 2 ] != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::4d:set";
- setup = :( A = rand( Float64, 1, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = rand();
- A[ 1, 1, j, 2 ] = v;
- if A[ 1, 1, j, 2 ] != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- name = "ndarray::5d:set";
- setup = :( A = rand( Float64, 1, 1, 1, 3, 2 ) );
- stmt = quote
- j = Int( floor( rand()*3.0 ) ) + 1;
- v = rand();
- A[ 1, 1, 1, j, 2 ] = v;
- if A[ 1, 1, 1, j, 2 ] != v
- throw( error( "unexpected value" ) );
- end
- end
- bench( name, setup, stmt );
-
- print_summary( count, count );
-end
-
-main();
diff --git a/benchmark/python/numpy/benchmark.py b/benchmark/python/numpy/benchmark.py
deleted file mode 100644
index 39b1520..0000000
--- a/benchmark/python/numpy/benchmark.py
+++ /dev/null
@@ -1,290 +0,0 @@
-#!/usr/bin/env python
-#
-# @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.
-
-"""Benchmark numpy.ndarray."""
-
-from __future__ import print_function
-import timeit
-
-REPEATS = 3
-COUNT = [0] # use a list to allow modification within nested scopes
-
-
-def print_version():
- """Print the TAP version."""
- print("TAP version 13")
-
-
-def print_summary(total, passing):
- """Print the benchmark summary.
-
- # Arguments
-
- * `total`: total number of tests
- * `passing`: number of passing tests
-
- """
- print("#")
- print("1.." + str(total)) # TAP plan
- print("# total " + str(total))
- print("# pass " + str(passing))
- print("#")
- print("# ok")
-
-
-def print_results(iterations, elapsed):
- """Print benchmark results.
-
- # Arguments
-
- * `iterations`: number of iterations
- * `elapsed`: elapsed time (in seconds)
-
- # Examples
-
- ``` python
- python> print_results(100000, 0.131009101868)
- ```
- """
- rate = iterations / elapsed
-
- print(" ---")
- print(" iterations: " + str(iterations))
- print(" elapsed: " + str(elapsed))
- print(" rate: " + str(rate))
- print(" ...")
-
-
-def benchmark(name, setup, stmt, iterations):
- """Run a benchmark and print benchmark results.
-
- # Arguments
-
- * `name`: benchmark name (suffix)
- * `setup`: benchmark setup
- * `stmt`: statement to benchmark
- * `iterations`: number of iterations
-
- # Examples
-
- ``` python
- python> benchmark("::random", "from random import random;", "y = random()", 1000000)
- ```
- """
- t = timeit.Timer(stmt, setup=setup)
-
- i = 0
- while i < REPEATS:
- print("# python::numpy" + name)
- COUNT[0] += 1
- elapsed = t.timeit(number=iterations)
- print_results(iterations, elapsed)
- print("ok " + str(COUNT[0]) + " benchmark finished")
- i += 1
-
-
-def main():
- """Run the benchmarks."""
- # pylint: disable=too-many-statements
- print_version()
-
- name = "::instantiation"
- setup = "import numpy as np; x = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], dtype='float64'); shape = [3, 2]; strides = [2, 1]; offset = 0; order = 'C';"
- stmt = "y = np.ndarray(buffer=x, shape=shape, strides=strides, offset=offset, order=order)"
- iterations = 100000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:data"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.data"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:dtype"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.dtype"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:flags"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.flags"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:length"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.size"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:BYTES_PER_ELEMENT"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.itemsize"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:byteLength"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.nbytes"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:ndims"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.ndim"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:shape"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.shape"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::get:strides"
- setup = "import numpy as np; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape);"
- stmt = "z = y.strides"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::1d:get"
- setup = "import numpy as np; from math import floor; from random import random; shape = [6]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y[int(floor(random()*6.0))]"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::2d:get"
- setup = "import numpy as np; from math import floor; from random import random; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y[int(floor(random()*3.0)), 1]"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::3d:get"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y[0, int(floor(random()*3.0)), 1]"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::4d:get"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y[0, 0, int(floor(random()*3.0)), 1]"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::5d:get"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y[0, 0, 0, int(floor(random()*3.0)), 1]"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::1d:set"
- setup = "import numpy as np; from math import floor; from random import random; shape = [6]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y[int(floor(random()*6.0))] = random()"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::2d:set"
- setup = "import numpy as np; from math import floor; from random import random; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y[int(floor(random()*3.0)), 1] = random()"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::3d:set"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y[0, int(floor(random()*3.0)), 1] = random()"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::4d:set"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y[0, 0, int(floor(random()*3.0)), 1] = random()"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::5d:set"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y[0, 0, 0, int(floor(random()*3.0)), 1] = random()"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::1d:iget"
- setup = "import numpy as np; from math import floor; from random import random; shape = [6]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y.item(int(floor(random()*6.0)))"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::2d:iget"
- setup = "import numpy as np; from math import floor; from random import random; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y.item(int(floor(random()*6.0)))"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::3d:iget"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y.item(int(floor(random()*6.0)))"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::4d:iget"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y.item(int(floor(random()*6.0)))"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::5d:iget"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "z = y.item(int(floor(random()*6.0)))"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::1d:iset"
- setup = "import numpy as np; from math import floor; from random import random; shape = [6]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y.itemset(int(floor(random()*6.0)), random())"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::2d:iset"
- setup = "import numpy as np; from math import floor; from random import random; shape = [3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y.itemset(int(floor(random()*6.0)), random())"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::3d:iset"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y.itemset(int(floor(random()*6.0)), random())"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::4d:iset"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y.itemset(int(floor(random()*6.0)), random())"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- name = "::5d:iset"
- setup = "import numpy as np; from math import floor; from random import random; shape = [1, 1, 1, 3, 2]; y = np.ndarray(buffer=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape=shape, dtype='float64');"
- stmt = "y.itemset(int(floor(random()*6.0)), random())"
- iterations = 1000000
- benchmark(name, setup, stmt, iterations)
-
- print_summary(COUNT[0], COUNT[0])
-
-
-if __name__ == "__main__":
- main()
diff --git a/branches.md b/branches.md
deleted file mode 100644
index 26b1a61..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/ndarray/ctor"
-%% click B href "https://github.com/stdlib-js/ndarray-ctor/tree/main"
-%% click C href "https://github.com/stdlib-js/ndarray-ctor/tree/production"
-%% click D href "https://github.com/stdlib-js/ndarray-ctor/tree/esm"
-%% click E href "https://github.com/stdlib-js/ndarray-ctor/tree/deno"
-%% click F href "https://github.com/stdlib-js/ndarray-ctor/tree/umd"
-```
-
-[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
-[production-url]: https://github.com/stdlib-js/ndarray-ctor/tree/production
-[deno-url]: https://github.com/stdlib-js/ndarray-ctor/tree/deno
-[deno-readme]: https://github.com/stdlib-js/ndarray-ctor/blob/deno/README.md
-[umd-url]: https://github.com/stdlib-js/ndarray-ctor/tree/umd
-[umd-readme]: https://github.com/stdlib-js/ndarray-ctor/blob/umd/README.md
-[esm-url]: https://github.com/stdlib-js/ndarray-ctor/tree/esm
-[esm-readme]: https://github.com/stdlib-js/ndarray-ctor/blob/esm/README.md
\ No newline at end of file
diff --git a/browser.js b/browser.js
new file mode 100644
index 0000000..bdaa72c
--- /dev/null
+++ b/browser.js
@@ -0,0 +1,3 @@
+// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
+var t,e;t=this,e=function(){"use strict";var t="function"==typeof Object.defineProperty?Object.defineProperty:null,e=Object.defineProperty;function r(t){return"number"==typeof t}function n(t){var e,r="";for(e=0;e0&&(e-=1),n=i.toExponential(e)):n=i.toPrecision(t.precision),t.alternate||(n=h.call(n,d,"$1e"),n=h.call(n,w,"e"),n=h.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),t.alternate&&(n=h.call(n,m,"$1."),n=h.call(n,y,"$1.e")),i>=0&&t.sign&&(n=t.sign+n),n=t.specifier===l.call(t.specifier)?l.call(n):s.call(n)}function v(t){var e,r="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=T(a)?String(n.arg):_(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=b(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(c=n.arg,p=n.width,m=n.padRight,y=void 0,(y=p-c.length)<0?c:c=m?c+v(y):v(y)+c)),f+=n.arg||"",s+=1}return f}var j=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function V(t){var e={mapping:t[1]?parseInt(t[1],10):void 0,flags:t[2],width:t[3],precision:t[5],specifier:t[6]};return"."===t[4]&&void 0===t[5]&&(e.precision="1"),e}function O(t){var e,r,n,i;for(r=[],i=0,n=j.exec(t);n;)(e=t.slice(i,j.lastIndex-n[0].length)).length&&r.push(e),r.push(V(n)),i=j.lastIndex,n=j.exec(t);return(e=t.slice(i)).length&&r.push(e),r}function S(t){var e,r;if("string"!=typeof t)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));for(e=[O(t)],r=1;r=0&&t.length<=Y}function W(t){return"number"==typeof t}var G="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function J(){return G&&"symbol"==typeof Symbol.toStringTag}var $=Object.prototype.toString,z=Object.prototype.hasOwnProperty;function X(t,e){return null!=t&&z.call(t,e)}var Z="function"==typeof Symbol?Symbol:void 0,H="function"==typeof Z?Z.toStringTag:"",Q=J()?function(t){var e,r,n;if(null==t)return $.call(t);r=t[H],e=X(t,H);try{t[H]=void 0}catch(e){return $.call(t)}return n=$.call(t),e?t[H]=r:delete t[H],n}:function(t){return $.call(t)},q=Number,K=q.prototype.toString,tt=J();function et(t){return"object"==typeof t&&(t instanceof q||(tt?function(t){try{return K.call(t),!0}catch(t){return!1}}(t):"[object Number]"===Q(t)))}function rt(t){return W(t)||et(t)}C(rt,"isPrimitive",W),C(rt,"isObject",et);var nt=Number.POSITIVE_INFINITY,it=q.NEGATIVE_INFINITY;function ot(t){return tit&&P(t)}function at(t){return W(t)&&ot(t)}function ut(t){return et(t)&&ot(t.valueOf())}function ft(t){return at(t)||ut(t)}function st(t){return at(t)&&t>=0}function lt(t){return ut(t)&&t.valueOf()>=0}function ht(t){return st(t)||lt(t)}C(ft,"isPrimitive",at),C(ft,"isObject",ut),C(ht,"isPrimitive",st),C(ht,"isObject",lt);var ct=4294967295;function pt(t){if("function"!=typeof t)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",t));return function(e){var r,n;if(!function(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&P(t.length)&&t.length>=0&&t.length<=ct}(e))return!1;if(0===(r=e.length))return!1;for(n=0;n=0&&t.length<=ct}var Qe="function"==typeof ArrayBuffer;function qe(t){return Qe&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===Q(t)}function Ke(t){return"object"==typeof t&&null!==t&&!kt(t)}function tr(t){return"string"==typeof t}var er=String.prototype.valueOf,rr=J();function nr(t){return"object"==typeof t&&(t instanceof String||(rr?function(t){try{return er.call(t),!0}catch(t){return!1}}(t):"[object String]"===Q(t)))}function ir(t){return tr(t)||nr(t)}function or(t,e){if(!(this instanceof or))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!W(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!W(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}C(ir,"isPrimitive",tr),C(ir,"isObject",nr),C(or,"BYTES_PER_ELEMENT",8),C(or.prototype,"BYTES_PER_ELEMENT",8),C(or.prototype,"byteLength",16),C(or.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(or.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var ar="function"==typeof Math.fround?Math.fround:null,ur=new me(1),fr="function"==typeof ar?ar:function(t){return ur[0]=t,ur[0]};function sr(t,e){if(!(this instanceof sr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!W(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!W(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:fr(t)}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:fr(e)}),this}function lr(t){return t instanceof or||t instanceof sr||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function hr(t){return P(t/2)}C(sr,"BYTES_PER_ELEMENT",4),C(sr.prototype,"BYTES_PER_ELEMENT",4),C(sr.prototype,"byteLength",8),C(sr.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(sr.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var cr=8;function pr(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===cr}var mr=16;function yr(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===mr}function gr(){return"function"==typeof Z&&"symbol"==typeof Z("foo")&&X(Z,"iterator")&&"symbol"==typeof Z.iterator}var wr=gr()?Symbol.iterator:null;function dr(t,e,r){N(t,e,{configurable:!1,enumerable:!1,get:r})}function br(t,e){if(!(this instanceof br))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!W(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!W(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:fr(t)}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:fr(e)}),this}function vr(t){return t.re}function _r(t){return t.im}function Er(t,e){return new me(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function Tr(t,e){return new se(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function xr(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(He(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!lr(n))return new TypeError(S("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(vr(n),_r(n))}return e}C(br,"BYTES_PER_ELEMENT",4),C(br.prototype,"BYTES_PER_ELEMENT",4),C(br.prototype,"byteLength",8),C(br.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(br.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Ar=2*me.BYTES_PER_ELEMENT,jr=gr();function Vr(t){return t instanceof Ir||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Or(t){return t===Ir||"Complex128Array"===t.name}function Sr(t,e){return new br(t[e*=2],t[e+1])}function Ir(){var t,e,r,n;if(e=arguments.length,!(this instanceof Ir))return 0===e?new Ir:1===e?new Ir(arguments[0]):2===e?new Ir(arguments[0],arguments[1]):new Ir(arguments[0],arguments[1],arguments[2]);if(0===e)r=new me(0);else if(1===e)if(st(arguments[0]))r=new me(2*arguments[0]);else if(D(arguments[0]))if((n=(r=arguments[0]).length)&&kt(r)&&lr(r[0])){if(r=function(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;ir.byteLength-t)throw new RangeError(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Ar));r=new me(r,t,2*n)}}return C(this,"_buffer",r),C(this,"_length",r.length/2),this}function Rr(t,e){if(!(this instanceof Rr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!W(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!W(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}function Lr(t){return t.re}function Fr(t){return t.im}function Ur(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(He(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!lr(n))return new TypeError(S("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(Lr(n),Fr(n))}return e}C(Ir,"BYTES_PER_ELEMENT",Ar),C(Ir,"name","Complex64Array"),C(Ir,"from",(function(t){var e,r,n,i,o,a,u,f,s,l,h,c;if(!Dt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Or(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!Dt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(Vr(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(D(t)){if(n){for(f=t.length,u=t.get&&t.set?te("default"):re("default"),h=0;h=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Ke(t)&&jr&&Dt(t[wr])){if(!Dt((o=t[wr]()).next))throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,He(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!lr(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(vr(o),_r(o))}return n}(o,n,e):xr(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Sr(this._buffer,t)})),dr(Ir.prototype,"buffer",(function(){return this._buffer.buffer})),dr(Ir.prototype,"byteLength",(function(){return this._buffer.byteLength})),dr(Ir.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Ir.prototype,"BYTES_PER_ELEMENT",Ir.BYTES_PER_ELEMENT),C(Ir.prototype,"copyWithin",(function(t,e){if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),C(Ir.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,C(r={},"next",(function(){var e;return o+=1,i||o>=n?{done:!0}:(e=new br(t[a+=2],t[a+1]),{value:[o,e],done:!1})})),C(r,"return",(function(t){return i=!0,arguments.length?{value:t,done:!0}:{done:!0}})),wr&&C(r,wr,(function(){return e.entries()})),r})),C(Ir.prototype,"every",(function(t,e){var r,n;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!P(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));r<0&&(r+=i)<0&&(r=0),r>i&&(r=i)}else r=i}else e=0,r=i;for(a=vr(t),u=_r(t),f=e;f=0;n--)if(i=Sr(r,n),t.call(e,i,n,this))return i})),C(Ir.prototype,"findLastIndex",(function(t,e){var r,n,i;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=Sr(r,n),t.call(e,i,n,this))return n;return-1})),C(Ir.prototype,"forEach",(function(t,e){var r,n,i;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n=this._length))return Sr(this._buffer,t)})),C(Ir.prototype,"includes",(function(t,e){var r,n,i,o,a;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!lr(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=vr(t),o=_r(t),r=this._buffer,a=e;a1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=vr(t),o=_r(t),r=this._buffer,a=e;a1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=vr(t),o=_r(t),r=this._buffer,a=e;a>=0;a--)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),dr(Ir.prototype,"length",(function(){return this._length})),C(Ir.prototype,"map",(function(t,e){var r,n,i,o,a;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,r=(i=new this.constructor(this._length))._buffer,o=0;o1)n=e,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=Sr(r,0),o=1}for(;o1){if(!st(r=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if(lr(t)){if(r>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=vr(t),void(n[r+1]=_r(t))}if(Vr(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,s=n.byteOffset+r*Ar,e.buffer===n.buffer&&e.byteOffsets){for(i=new me(e.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,s=n.byteOffset+r*Ar,e.buffer===n.buffer&&e.byteOffsets){for(i=new me(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;fu&&(e=u)}}for(r=ti&&(e=i)}}return t>=i?(i=0,r=n.byteLength):t>=e?(i=0,r=n.byteOffset+t*Ar):(i=e-t,r=n.byteOffset+t*Ar),new this.constructor(n.buffer,r,i<0?0:i)})),C(Ir.prototype,"toReversed",(function(){var t,e,r,n,i,o;if(!Vr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,e=new this.constructor(r),n=this._buffer,t=e._buffer,i=0;i=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!lr(e))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(r=(n=new this.constructor(this._buffer))._buffer)[2*t]=vr(e),r[2*t+1]=_r(e),n})),C(Rr,"BYTES_PER_ELEMENT",8),C(Rr.prototype,"BYTES_PER_ELEMENT",8),C(Rr.prototype,"byteLength",16),C(Rr.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Rr.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Br=2*se.BYTES_PER_ELEMENT,kr=gr();function Nr(t){return t instanceof Pr||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Cr(t){return t===Pr||"Complex64Array"===t.name}function Mr(t,e){return new Rr(t[e*=2],t[e+1])}function Pr(){var t,e,r,n;if(e=arguments.length,!(this instanceof Pr))return 0===e?new Pr:1===e?new Pr(arguments[0]):2===e?new Pr(arguments[0],arguments[1]):new Pr(arguments[0],arguments[1],arguments[2]);if(0===e)r=new se(0);else if(1===e)if(st(arguments[0]))r=new se(2*arguments[0]);else if(D(arguments[0]))if((n=(r=arguments[0]).length)&&kt(r)&&lr(r[0])){if(r=function(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;ir.byteLength-t)throw new RangeError(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Br));r=new se(r,t,2*n)}}return C(this,"_buffer",r),C(this,"_length",r.length/2),this}C(Pr,"BYTES_PER_ELEMENT",Br),C(Pr,"name","Complex128Array"),C(Pr,"from",(function(t){var e,r,n,i,o,a,u,f,s,l,h,c;if(!Dt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Cr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!Dt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(Nr(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(D(t)){if(n){for(f=t.length,u=t.get&&t.set?te("default"):re("default"),h=0;h=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Ke(t)&&kr&&Dt(t[wr])){if(!Dt((o=t[wr]()).next))throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,He(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!lr(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Lr(o),Fr(o))}return n}(o,n,e):Ur(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Mr(this._buffer,t)})),dr(Pr.prototype,"buffer",(function(){return this._buffer.buffer})),dr(Pr.prototype,"byteLength",(function(){return this._buffer.byteLength})),dr(Pr.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Pr.prototype,"BYTES_PER_ELEMENT",Pr.BYTES_PER_ELEMENT),C(Pr.prototype,"copyWithin",(function(t,e){if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),C(Pr.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,C(r={},"next",(function(){var e;return o+=1,i||o>=n?{done:!0}:(e=new Rr(t[a+=2],t[a+1]),{value:[o,e],done:!1})})),C(r,"return",(function(t){return i=!0,arguments.length?{value:t,done:!0}:{done:!0}})),wr&&C(r,wr,(function(){return e.entries()})),r})),C(Pr.prototype,"every",(function(t,e){var r,n;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!P(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));r<0&&(r+=i)<0&&(r=0),r>i&&(r=i)}else r=i}else e=0,r=i;for(a=Lr(t),u=Fr(t),f=e;f=0;n--)if(i=Mr(r,n),t.call(e,i,n,this))return i})),C(Pr.prototype,"findLastIndex",(function(t,e){var r,n,i;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=Mr(r,n),t.call(e,i,n,this))return n;return-1})),C(Pr.prototype,"forEach",(function(t,e){var r,n,i;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n=this._length))return Mr(this._buffer,t)})),dr(Pr.prototype,"length",(function(){return this._length})),C(Pr.prototype,"includes",(function(t,e){var r,n,i,o,a;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!lr(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=Lr(t),o=Fr(t),r=this._buffer,a=e;a1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=Lr(t),o=Fr(t),r=this._buffer,a=e;a1){if(!P(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=Lr(t),o=Fr(t),r=this._buffer,a=e;a>=0;a--)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),C(Pr.prototype,"map",(function(t,e){var r,n,i,o,a;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,r=(i=new this.constructor(this._length))._buffer,o=0;o1)n=e,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=Mr(r,0),o=1}for(;o1){if(!st(r=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if(lr(t)){if(r>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=Lr(t),void(n[r+1]=Fr(t))}if(Nr(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,s=n.byteOffset+r*Br,e.buffer===n.buffer&&e.byteOffsets){for(i=new se(e.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,s=n.byteOffset+r*Br,e.buffer===n.buffer&&e.byteOffsets){for(i=new se(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;fu&&(e=u)}}for(r=ti&&(e=i)}}return t>=i?(i=0,r=n.byteLength):t>=e?(i=0,r=n.byteOffset+t*Br):(i=e-t,r=n.byteOffset+t*Br),new this.constructor(n.buffer,r,i<0?0:i)})),C(Pr.prototype,"toReversed",(function(){var t,e,r,n,i,o;if(!Nr(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,e=new this.constructor(r),n=this._buffer,t=e._buffer,i=0;i=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!lr(e))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(r=(n=new this.constructor(this._buffer))._buffer)[2*t]=Lr(e),r[2*t+1]=Fr(e),n}));var Yr=[se,me,Ae,ve,Be,Ie,Ze,Pe,Je,Ir,Pr],Dr=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],Wr=Dr.length;function Gr(t){var e;if(kt(t))return"generic";if(Mt(t))return null;for(e=0;e0&&e.push("generic"),e)}function Hr(){return{bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256}}function Qr(t,e,r){N(t,e,{configurable:!1,enumerable:!0,writable:!1,value:r})}function qr(t){return Object.keys(Object(t))}var Kr,tn=void 0!==Object.keys;function en(t){return"[object Arguments]"===Q(t)}Kr=function(){return en(arguments)}();var rn=Kr;function nn(t){return t!=t}function on(t){return W(t)&&nn(t)}function an(t){return et(t)&&nn(t.valueOf())}function un(t){return on(t)||an(t)}C(un,"isPrimitive",on),C(un,"isObject",an);var fn=Object.prototype.propertyIsEnumerable,sn=!fn.call("beep","0");function ln(t,e){var r;return null!=t&&(!(r=fn.call(t,e))&&sn&&ir(t)?!on(e=+e)&&at(e)&&e>=0&&e=0&&t.length<=ge&&X(t,"callee")&&!ln(t,"callee")},cn=Array.prototype.slice,pn=ln((function(){}),"prototype"),mn=!ln({toString:null},"toString");function yn(t,e,r){var n,i;if(!D(t)&&!tr(t))throw new TypeError(S("invalid argument. First argument must be an array-like object. Value: `%s`.",t));if(0===(n=t.length))return-1;if(3===arguments.length){if(!at(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(un(e)){for(;i0&&!X(t,"0"))for(u=0;u0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}C(An,"assign",(function(t,e,r,n){var i,o,a,u,f;for(i=t.length,o=r,a=r,f=0;f0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var jn=It(),Vn={binary:1,bool:1,complex64:8,complex128:16,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32};function On(t){return Math.abs(t)}function Sn(t,e){return e&&(2===t||3===t)}function In(t,e){return e&&(1===t||3===t)}function Rn(t){return t.re}function Ln(t){return t.im}var Fn=/[-\/\\^$*+?.()|[\]{}]/g,Un=RegExp.prototype.exec,Bn=J();function kn(t){return"object"==typeof t&&(t instanceof RegExp||(Bn?function(t){try{return Un.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===Q(t)))}function Nn(t,e,r){if(!tr(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));if(tr(e))e=new RegExp(function(t){var e,r;if(!tr(t))throw new TypeError(S("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(r=t.length-1;r>=0&&"/"!==t[r];r--);return void 0===r||r<=0?t.replace(Fn,"\\$&"):(e=(e=t.substring(1,r)).replace(Fn,"\\$&"),t=t[0]+e+t.substring(r))}(e),"g");else if(!kn(e))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",e));if(!tr(r)&&!Dt(r))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",r));return $r(t,e,r)}var Cn,Mn={int8:"new Int8Array( [ {{data}} ] )",uint8:"new Uint8Array( [ {{data}} ] )",uint8c:"new Uint8ClampedArray( [ {{data}} ] )",int16:"new Int16Array( [ {{data}} ] )",uint16:"new Uint16Array( [ {{data}} ] )",int32:"new Int32Array( [ {{data}} ] )",uint32:"new Uint32Array( [ {{data}} ] )",float32:"new Float32Array( [ {{data}} ] )",float64:"new Float64Array( [ {{data}} ] )",generic:"[ {{data}} ]",binary:"new Buffer( [ {{data}} ] )",complex64:"new Complex64Array( [ {{data}} ] )",complex128:"new Complex128Array( [ {{data}} ] )"},Pn={uint16:Ie,uint8:Pe};(Cn=new Pn.uint16(1))[0]=4660;var Yn,Dn=52===new Pn.uint8(Cn.buffer)[0],Wn="function"==typeof ArrayBuffer?ArrayBuffer:null,Gn="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Yn=function(){var t,e,r;if("function"!=typeof Wn)return!1;try{(t=qe(r=new Wn(16))&&"function"==typeof Wn.isView)&&((e=new se(r))[0]=-3.14,e[1]=NaN,t=t&&Wn.isView(e)&&16===r.byteLength&&-3.14===e[0]&&e[1]!=e[1])}catch(e){t=!1}return t}()?Gn:function(){throw new Error("not implemented")};var Jn,$n=Yn,zn="function"==typeof DataView,Xn="function"==typeof DataView?DataView:null,Zn="function"==typeof DataView?DataView:void 0;Jn=function(){var t,e,r,n;if("function"!=typeof Xn)return!1;try{r=new $n(24),e=new Xn(r,8),n=e,(t=(zn&&n instanceof DataView||"[object DataView]"===Q(n))&&"function"==typeof e.getFloat64&&"function"==typeof e.setFloat64)&&(e.setFloat64(0,-3.14),e.setFloat64(8,NaN),t=t&&e.buffer===r&&16===e.byteLength&&8===e.byteOffset&&-3.14===e.getFloat64(0)&&e.getFloat64(8)!=e.getFloat64(8))}catch(e){t=!1}return t}()?Zn:function(){throw new Error("not implemented")};var Hn=Jn,Qn="function"==typeof BigInt?BigInt:void 0,qn=["throw","normalize","clamp","wrap"];function Kn(){return qn.slice()}function ti(){return{throw:1,clamp:2,wrap:3,normalize:4}}C(Kn,"enum",ti);var ei={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256},ri=Xt(),ni={throw:1,clamp:2,wrap:3,normalize:4},ii=4294967295,oi=4294967296,ai=new Pe(8),ui=new Hn(ai.buffer);function fi(t,e,r,n){var i,o,a;if(0===t){for(a=0;a>>0,i=M(t/oi),Dn?(ui.setUint32(0,o,Dn),ui.setUint32(4,i,Dn)):(ui.setUint32(0,i,Dn),ui.setUint32(4,o,Dn)),a=0;a>>0,n=M(t/4294967296),r=new Hn(e.buffer),Dn?(r.setUint32(0,i,Dn),r.setUint32(4,n,Dn)):(r.setUint32(0,n,Dn),r.setUint32(4,i,Dn))),e}),"assign",fi);var si={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256},li=Xt(),hi={throw:1,clamp:2,wrap:3,normalize:4};function ci(t,e,r,n,i,o){var a,u,f,s,l;if(!(this instanceof ci))return new ci(t,e,r,n,i,o);for(s=1,l=0;li&&(n=!1),!n&&!e)return 0;i=o}return n&&e?3:n?1:2}(n),this._flags={ROW_MAJOR_CONTIGUOUS:In(f,a),COLUMN_MAJOR_CONTIGUOUS:Sn(f,a),READONLY:!1},this.__meta_dataview__=null,this}function pi(){return{dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32",boolean:"bool"},order:"row-major",casting:"safe",index_mode:"throw"}}C(ci,"name","ndarray"),dr(ci.prototype,"byteLength",(function(){return this._byteLength})),dr(ci.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),dr(ci.prototype,"data",(function(){return this._buffer})),dr(ci.prototype,"dtype",(function(){return this._dtype})),dr(ci.prototype,"flags",(function(){return{ROW_MAJOR_CONTIGUOUS:(t=this._flags).ROW_MAJOR_CONTIGUOUS,COLUMN_MAJOR_CONTIGUOUS:t.COLUMN_MAJOR_CONTIGUOUS,READONLY:t.READONLY};var t})),dr(ci.prototype,"length",(function(){return this._length})),dr(ci.prototype,"ndims",(function(){return this._ndims})),dr(ci.prototype,"offset",(function(){return this._offset})),dr(ci.prototype,"order",(function(){return this._order})),dr(ci.prototype,"shape",(function(){return this._shape.slice()})),dr(ci.prototype,"strides",(function(){return this._strides.slice()})),C(ci.prototype,"get",(function(){var t,e;for(t=this._offset,e=0;e=0;a--)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),C(ci.prototype,"set",(function(){var t,e;for(t=this._offset,e=0;e=0;u--)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this})),C(ci.prototype,"toString",(function(){var t,e,r,n,i,o;if(e=this._shape.length,r="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o=0;o--)t+=Rn(i=this.iget(this._length-1-o))+", "+Ln(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(r+=Nn(Mn[this.dtype],"{{data}}",t),r+=", ",r+=0===e?"[]":"[ "+this._shape.join(", ")+" ]",r+=", ",r+="[ ",0===e)r+="0";else for(o=0;oe?e:t}function Ei(t,e){var r=e+1;return t<0?((t+=r)<0&&0!=(t%=r)&&(t+=r),t):t>e?((t-=r)>e&&(t%=r),t):t}function Ti(t,e){return t<0?(t+=e+1)<0?-1:t:t>e?-1:t}var xi=Jr(Kn()),Ai={wrap:Ei,clamp:_i,normalize:function(t,e){var r=Ti(t,e);if(r<0||r>e)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",e,t));return r},throw:function(t,e){if(t<0||t>e)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",e,t));return t}};function ji(t,e,r){var n;if("clamp"===r)return _i(t,e);if("wrap"===r)return Ei(t,e);if(n=t,"normalize"===r&&(n=Ti(n,e)),n<0||n>e)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",e,t));return n}C(ji,"factory",(function(t){if(!xi(t))throw new TypeError(S("invalid argument. First argument must be a recognized index mode. Value: `%s`.",t));return Ai[t]}));var Vi=ci.prototype.iget,Oi=ci.prototype.iset;function Si(t,e){var r,n;for(r=[],n=0;n0))throw new TypeError(vi("0jp5S",r));if((u=r.length)>32767)throw new RangeError(vi("0jp5T",32767,u));if(!wt(n))throw new TypeError(vi("0jp5U",n));if(u>0){if(n.length!==u)throw new RangeError(vi("0jp5V",u,n.length))}else{if(1!==n.length)throw new RangeError(vi("0jp0f"));if(0!==n[0])throw new RangeError(vi("0jpDt",n[0]))}if(!st(i))throw new TypeError(vi("0jp5X",i));if(!function(t){var e;for(e=0;e0&&!function(t,e,r,n){var i=An(e,r,n);return i[0]>=0&&i[1]0)throw new Error(vi("0jpCz"));if((f={}).mode=ki,f.readonly=!1,arguments.length>6&&(s=function(t,e){var r;if(!Bi(e))return new TypeError(vi("0jp2V",e));if(X(e,"mode")&&(t.mode=e.mode,!xi(t.mode)))return new TypeError(vi("0jp5a","mode",t.mode));if(X(e,"submode")){if(t.submode=e.submode,!He(t.submode))return new TypeError(vi("0jp5b","submode",t.submode));if(0===t.submode.length)return new TypeError(vi("0jp5b","submode",t.submode.join(",")));for(r=0;r0){if(!at(t))throw new TypeError(vi("0jp5O",t));return t=ji(t,this._length-1,this._mode),Vi.call(this,t)}return Vi.call(this)})),C(Ni.prototype,"set",(function(){var t,e,r,n;if(this._flags.READONLY)throw new Error(vi("0jp0e"));if(arguments.length!==this._ndims+1)throw new RangeError(vi("0jp5M",this._ndims,arguments.length));for(t=this._offset,r=this._submode.length,n=0;n0){if(!at(t))throw new TypeError(vi("0jp5O",t));t=ji(t,this._length-1,this._mode),Oi.call(this,t,e)}else Oi.call(this,t);return this})),Ni},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ndarray=e();
+//# sourceMappingURL=browser.js.map
diff --git a/browser.js.map b/browser.js.map
new file mode 100644
index 0000000..330debc
--- /dev/null
+++ b/browser.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/utils-define-property/lib/define_property.js","../node_modules/@stdlib/utils-define-property/lib/builtin.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_number.js","../node_modules/@stdlib/string-base-format-interpolate/lib/zero_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_integer.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_double.js","../node_modules/@stdlib/string-base-format-interpolate/lib/space_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/main.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_string.js","../node_modules/@stdlib/string-base-format-tokenize/lib/main.js","../node_modules/@stdlib/string-format/lib/main.js","../node_modules/@stdlib/string-format/lib/is_string.js","../node_modules/@stdlib/utils-define-property/lib/polyfill.js","../node_modules/@stdlib/utils-define-property/lib/index.js","../node_modules/@stdlib/utils-define-property/lib/has_define_property_support.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/main.js","../node_modules/@stdlib/math-base-special-floor/lib/main.js","../node_modules/@stdlib/math-base-assert-is-integer/lib/main.js","../node_modules/@stdlib/constants-array-max-typed-array-length/lib/index.js","../node_modules/@stdlib/assert-is-collection/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/primitive.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/number-ctor/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/tostring.js","../node_modules/@stdlib/assert-is-number/lib/object.js","../node_modules/@stdlib/assert-is-number/lib/try2serialize.js","../node_modules/@stdlib/assert-is-number/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/index.js","../node_modules/@stdlib/constants-float64-pinf/lib/index.js","../node_modules/@stdlib/constants-float64-ninf/lib/index.js","../node_modules/@stdlib/assert-is-integer/lib/integer.js","../node_modules/@stdlib/assert-is-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-integer/lib/object.js","../node_modules/@stdlib/assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/object.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/index.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/index.js","../node_modules/@stdlib/constants-array-max-array-length/lib/index.js","../node_modules/@stdlib/assert-tools-array-like-function/lib/main.js","../node_modules/@stdlib/assert-is-array-like/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-integer-array/lib/index.js","../node_modules/@stdlib/assert-is-integer-array/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/re.js","../node_modules/@stdlib/assert-is-boolean/lib/primitive.js","../node_modules/@stdlib/boolean-ctor/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/tostring.js","../node_modules/@stdlib/assert-is-boolean/lib/object.js","../node_modules/@stdlib/assert-is-boolean/lib/try2serialize.js","../node_modules/@stdlib/assert-is-boolean/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/index.js","../node_modules/@stdlib/utils-global/lib/self.js","../node_modules/@stdlib/utils-global/lib/window.js","../node_modules/@stdlib/utils-global/lib/global_this.js","../node_modules/@stdlib/utils-global/lib/browser.js","../node_modules/@stdlib/utils-global/lib/codegen.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/nodelist.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/typedarray.js","../node_modules/@stdlib/regexp-function-name/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/regexp.js","../node_modules/@stdlib/regexp-function-name/lib/index.js","../node_modules/@stdlib/assert-is-array/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/index.js","../node_modules/@stdlib/assert-tools-array-function/lib/main.js","../node_modules/@stdlib/assert-is-buffer/lib/main.js","../node_modules/@stdlib/utils-constructor-name/lib/main.js","../node_modules/@stdlib/utils-type-of/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/check.js","../node_modules/@stdlib/utils-type-of/lib/polyfill.js","../node_modules/@stdlib/utils-type-of/lib/main.js","../node_modules/@stdlib/assert-is-function/lib/main.js","../node_modules/@stdlib/ndarray-orders/lib/main.js","../node_modules/@stdlib/blas-base-layouts/lib/enum.js","../node_modules/@stdlib/blas-base-layouts/lib/index.js","../node_modules/@stdlib/blas-base-layouts/lib/main.js","../node_modules/@stdlib/ndarray-orders/lib/enum.js","../node_modules/@stdlib/ndarray-orders/lib/index.js","../node_modules/@stdlib/ndarray-base-assert-is-order/lib/main.js","../node_modules/@stdlib/array-base-assert-is-accessor-array/lib/main.js","../node_modules/@stdlib/array-base-accessor-getter/lib/main.js","../node_modules/@stdlib/array-base-getter/lib/main.js","../node_modules/@stdlib/array-dtype/lib/ctor2dtype.js","../node_modules/@stdlib/array-float64/lib/index.js","../node_modules/@stdlib/assert-is-float64array/lib/main.js","../node_modules/@stdlib/assert-has-float64array-support/lib/float64array.js","../node_modules/@stdlib/array-float64/lib/main.js","../node_modules/@stdlib/assert-has-float64array-support/lib/main.js","../node_modules/@stdlib/array-float64/lib/polyfill.js","../node_modules/@stdlib/array-float32/lib/index.js","../node_modules/@stdlib/assert-is-float32array/lib/main.js","../node_modules/@stdlib/assert-has-float32array-support/lib/float32array.js","../node_modules/@stdlib/array-float32/lib/main.js","../node_modules/@stdlib/assert-has-float32array-support/lib/main.js","../node_modules/@stdlib/array-float32/lib/polyfill.js","../node_modules/@stdlib/array-uint32/lib/index.js","../node_modules/@stdlib/assert-is-uint32array/lib/main.js","../node_modules/@stdlib/constants-uint32-max/lib/index.js","../node_modules/@stdlib/assert-has-uint32array-support/lib/uint32array.js","../node_modules/@stdlib/array-uint32/lib/main.js","../node_modules/@stdlib/assert-has-uint32array-support/lib/main.js","../node_modules/@stdlib/array-uint32/lib/polyfill.js","../node_modules/@stdlib/array-int32/lib/index.js","../node_modules/@stdlib/assert-is-int32array/lib/main.js","../node_modules/@stdlib/assert-has-int32array-support/lib/int32array.js","../node_modules/@stdlib/array-int32/lib/main.js","../node_modules/@stdlib/assert-has-int32array-support/lib/main.js","../node_modules/@stdlib/constants-int32-min/lib/index.js","../node_modules/@stdlib/array-int32/lib/polyfill.js","../node_modules/@stdlib/array-uint16/lib/index.js","../node_modules/@stdlib/assert-is-uint16array/lib/main.js","../node_modules/@stdlib/assert-has-uint16array-support/lib/uint16array.js","../node_modules/@stdlib/array-uint16/lib/main.js","../node_modules/@stdlib/assert-has-uint16array-support/lib/main.js","../node_modules/@stdlib/array-uint16/lib/polyfill.js","../node_modules/@stdlib/array-int16/lib/index.js","../node_modules/@stdlib/assert-is-int16array/lib/main.js","../node_modules/@stdlib/assert-has-int16array-support/lib/int16array.js","../node_modules/@stdlib/array-int16/lib/main.js","../node_modules/@stdlib/assert-has-int16array-support/lib/main.js","../node_modules/@stdlib/constants-int16-min/lib/index.js","../node_modules/@stdlib/array-int16/lib/polyfill.js","../node_modules/@stdlib/array-uint8/lib/index.js","../node_modules/@stdlib/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/uint8array.js","../node_modules/@stdlib/array-uint8/lib/main.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/main.js","../node_modules/@stdlib/array-uint8/lib/polyfill.js","../node_modules/@stdlib/array-uint8c/lib/index.js","../node_modules/@stdlib/assert-is-uint8clampedarray/lib/main.js","../node_modules/@stdlib/assert-has-uint8clampedarray-support/lib/uint8clampedarray.js","../node_modules/@stdlib/array-uint8c/lib/main.js","../node_modules/@stdlib/assert-has-uint8clampedarray-support/lib/main.js","../node_modules/@stdlib/array-uint8c/lib/polyfill.js","../node_modules/@stdlib/array-int8/lib/index.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../node_modules/@stdlib/array-int8/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../node_modules/@stdlib/array-int8/lib/polyfill.js","../node_modules/@stdlib/assert-is-array-like-object/lib/main.js","../node_modules/@stdlib/assert-is-arraybuffer/lib/main.js","../node_modules/@stdlib/assert-is-object/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/valueof.js","../node_modules/@stdlib/assert-is-string/lib/object.js","../node_modules/@stdlib/assert-is-string/lib/try2valueof.js","../node_modules/@stdlib/assert-is-string/lib/main.js","../node_modules/@stdlib/assert-is-complex-like/node_modules/@stdlib/complex-float64-ctor/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/index.js","../node_modules/@stdlib/assert-is-complex-like/node_modules/@stdlib/complex-float64-ctor/lib/tostring.js","../node_modules/@stdlib/assert-is-complex-like/node_modules/@stdlib/complex-float64-ctor/lib/tojson.js","../node_modules/@stdlib/number-float64-base-to-float32/lib/main.js","../node_modules/@stdlib/number-float64-base-to-float32/lib/polyfill.js","../node_modules/@stdlib/number-float64-base-to-float32/lib/index.js","../node_modules/@stdlib/complex-float32-ctor/lib/main.js","../node_modules/@stdlib/assert-is-complex-like/lib/main.js","../node_modules/@stdlib/math-base-assert-is-even/lib/main.js","../node_modules/@stdlib/complex-float32-ctor/lib/tostring.js","../node_modules/@stdlib/complex-float32-ctor/lib/tojson.js","../node_modules/@stdlib/array-base-assert-is-complex64array/lib/main.js","../node_modules/@stdlib/array-base-assert-is-complex128array/lib/main.js","../node_modules/@stdlib/assert-has-iterator-symbol-support/lib/main.js","../node_modules/@stdlib/symbol-iterator/lib/main.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-accessor/lib/main.js","../node_modules/@stdlib/complex-float32/lib/main.js","../node_modules/@stdlib/complex-realf/lib/main.js","../node_modules/@stdlib/complex-imagf/lib/main.js","../node_modules/@stdlib/strided-base-reinterpret-complex64/lib/main.js","../node_modules/@stdlib/strided-base-reinterpret-complex128/lib/main.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex64/lib/from_iterator.js","../node_modules/@stdlib/complex-float32/lib/tostring.js","../node_modules/@stdlib/complex-float32/lib/tojson.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex64/lib/main.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex64/lib/from_array.js","../node_modules/@stdlib/complex-float64/lib/main.js","../node_modules/@stdlib/complex-real/lib/main.js","../node_modules/@stdlib/complex-imag/lib/main.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex128/lib/from_iterator.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex64/lib/from_iterator_map.js","../node_modules/@stdlib/complex-float64/lib/tostring.js","../node_modules/@stdlib/complex-float64/lib/tojson.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex128/lib/main.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex128/lib/from_array.js","../node_modules/@stdlib/array-dtype/node_modules/@stdlib/array-complex128/lib/from_iterator_map.js","../node_modules/@stdlib/array-dtype/lib/ctors.js","../node_modules/@stdlib/array-dtype/lib/dtypes.js","../node_modules/@stdlib/array-dtype/lib/main.js","../node_modules/@stdlib/array-base-assert-contains/lib/factory.js","../node_modules/@stdlib/string-base-replace/lib/main.js","../node_modules/@stdlib/array-base-assert-contains/lib/index.js","../node_modules/@stdlib/array-base-assert-contains/lib/main.js","../node_modules/@stdlib/ndarray-dtypes/lib/main.js","../node_modules/@stdlib/ndarray-dtypes/lib/enum.js","../node_modules/@stdlib/utils-define-read-only-property/lib/main.js","../node_modules/@stdlib/utils-keys/lib/builtin.js","../node_modules/@stdlib/utils-keys/lib/has_builtin.js","../node_modules/@stdlib/assert-is-arguments/lib/detect.js","../node_modules/@stdlib/assert-is-arguments/lib/main.js","../node_modules/@stdlib/math-base-assert-is-nan/lib/main.js","../node_modules/@stdlib/assert-is-nan/lib/primitive.js","../node_modules/@stdlib/assert-is-nan/lib/object.js","../node_modules/@stdlib/assert-is-nan/lib/main.js","../node_modules/@stdlib/assert-is-nan/lib/index.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/native.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/has_string_enumerability_bug.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/main.js","../node_modules/@stdlib/assert-is-arguments/lib/index.js","../node_modules/@stdlib/assert-is-arguments/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/builtin_wrapper.js","../node_modules/@stdlib/utils-keys/lib/has_enumerable_prototype_bug.js","../node_modules/@stdlib/utils-noop/lib/main.js","../node_modules/@stdlib/utils-keys/lib/has_non_enumerable_properties_bug.js","../node_modules/@stdlib/utils-index-of/lib/main.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype.js","../node_modules/@stdlib/utils-keys/lib/main.js","../node_modules/@stdlib/utils-keys/lib/window.js","../node_modules/@stdlib/utils-keys/lib/has_automation_equality_bug.js","../node_modules/@stdlib/utils-keys/lib/has_window.js","../node_modules/@stdlib/utils-keys/lib/has_arguments_bug.js","../node_modules/@stdlib/utils-keys/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype_wrapper.js","../node_modules/@stdlib/ndarray-dtypes/lib/index.js","../node_modules/@stdlib/ndarray-dtypes/lib/assign.js","../node_modules/@stdlib/ndarray-base-assert-is-data-type/lib/main.js","../node_modules/@stdlib/ndarray-base-minmax-view-buffer-index/lib/main.js","../node_modules/@stdlib/ndarray-base-minmax-view-buffer-index/lib/index.js","../node_modules/@stdlib/ndarray-base-minmax-view-buffer-index/lib/assign.js","../node_modules/@stdlib/assert-has-bigint-support/lib/main.js","../node_modules/@stdlib/math-base-special-abs/lib/main.js","../node_modules/@stdlib/ndarray-base-ctor/lib/is_column_major_contiguous.js","../node_modules/@stdlib/ndarray-base-ctor/lib/is_row_major_contiguous.js","../node_modules/@stdlib/complex-float64-real/lib/main.js","../node_modules/@stdlib/complex-float64-imag/lib/main.js","../node_modules/@stdlib/utils-escape-regexp-string/lib/main.js","../node_modules/@stdlib/assert-is-regexp/lib/exec.js","../node_modules/@stdlib/assert-is-regexp/lib/main.js","../node_modules/@stdlib/assert-is-regexp/lib/try2exec.js","../node_modules/@stdlib/string-replace/lib/main.js","../node_modules/@stdlib/ndarray-base-ctor/lib/tostring.js","../node_modules/@stdlib/assert-is-little-endian/lib/main.js","../node_modules/@stdlib/assert-is-little-endian/lib/ctors.js","../node_modules/@stdlib/array-buffer/lib/index.js","../node_modules/@stdlib/assert-has-arraybuffer-support/lib/arraybuffer.js","../node_modules/@stdlib/array-buffer/lib/main.js","../node_modules/@stdlib/assert-has-arraybuffer-support/lib/main.js","../node_modules/@stdlib/array-buffer/lib/polyfill.js","../node_modules/@stdlib/array-dataview/lib/index.js","../node_modules/@stdlib/assert-is-dataview/lib/main.js","../node_modules/@stdlib/assert-has-dataview-support/lib/dataview.js","../node_modules/@stdlib/array-dataview/lib/main.js","../node_modules/@stdlib/assert-has-dataview-support/lib/main.js","../node_modules/@stdlib/array-dataview/lib/polyfill.js","../node_modules/@stdlib/bigint-ctor/lib/main.js","../node_modules/@stdlib/ndarray-index-modes/lib/main.js","../node_modules/@stdlib/ndarray-index-modes/lib/enum.js","../node_modules/@stdlib/ndarray-index-modes/lib/index.js","../node_modules/@stdlib/ndarray-base-ctor/lib/meta2dataview.js","../node_modules/@stdlib/number-float64-base-to-int64-bytes/lib/assign.js","../node_modules/@stdlib/number-float64-base-to-int64-bytes/lib/index.js","../node_modules/@stdlib/number-float64-base-to-int64-bytes/lib/main.js","../node_modules/@stdlib/ndarray-base-ctor/lib/meta2dataview.polyfill.js","../node_modules/@stdlib/ndarray-base-ctor/lib/main.js","../node_modules/@stdlib/ndarray-base-bytes-per-element/lib/main.js","../node_modules/@stdlib/ndarray-base-iteration-order/lib/main.js","../node_modules/@stdlib/ndarray-base-ctor/lib/is_contiguous.js","../node_modules/@stdlib/ndarray-base-strides2order/lib/main.js","../node_modules/@stdlib/ndarray-defaults/lib/main.js","../node_modules/@stdlib/ndarray-base-ctor/lib/copy_flags.js","../node_modules/@stdlib/ndarray-base-ctor/lib/get.js","../node_modules/@stdlib/ndarray-base-ctor/lib/iget.js","../node_modules/@stdlib/ndarray-base-ctor/lib/set.js","../node_modules/@stdlib/ndarray-base-ctor/lib/iset.js","../node_modules/@stdlib/ndarray-base-ctor/lib/tojson.js","../node_modules/@stdlib/ndarray-defaults/lib/get.js","../node_modules/@stdlib/utils-inherit/lib/validate.js","../node_modules/@stdlib/ndarray-defaults/lib/index.js","../node_modules/@stdlib/utils-inherit/lib/native.js","../node_modules/@stdlib/utils-inherit/lib/polyfill.js","../node_modules/@stdlib/utils-inherit/lib/detect.js","../node_modules/@stdlib/error-tools-fmtprodmsg/lib/main.js","../node_modules/@stdlib/ndarray-base-clamp-index/lib/main.js","../node_modules/@stdlib/ndarray-base-wrap-index/lib/main.js","../node_modules/@stdlib/ndarray-base-normalize-index/lib/main.js","../node_modules/@stdlib/ndarray-base-assert-is-index-mode/lib/main.js","../node_modules/@stdlib/ndarray-base-ind/lib/factory.js","../node_modules/@stdlib/ndarray-base-ind/lib/main.js","../node_modules/@stdlib/ndarray-base-ind/lib/index.js","../lib/iget.js","../lib/iset.js","../lib/copy_array.js","../node_modules/@stdlib/object-ctor/lib/main.js","../node_modules/@stdlib/utils-get-prototype-of/lib/detect.js","../node_modules/@stdlib/utils-get-prototype-of/lib/native.js","../node_modules/@stdlib/utils-get-prototype-of/lib/polyfill.js","../node_modules/@stdlib/utils-get-prototype-of/lib/proto.js","../node_modules/@stdlib/assert-is-plain-object/lib/main.js","../node_modules/@stdlib/utils-get-prototype-of/lib/main.js","../lib/main.js","../node_modules/@stdlib/ndarray-base-assert-is-buffer-length-compatible/lib/main.js","../node_modules/@stdlib/ndarray-base-numel/lib/main.js","../lib/validate.js","../node_modules/@stdlib/utils-inherit/lib/main.js","../lib/get.js","../lib/set.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nvar main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nexport default main;\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// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' ); // NOTE: we inline the `isNumber.isPrimitive` function from `@stdlib/assert/is-number` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Tests if a string starts with a minus sign (`-`).\n*\n* @private\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string starts with a minus sign (`-`)\n*/\nfunction startsWithMinus( str ) {\n\treturn str[ 0 ] === '-';\n}\n\n/**\n* Returns a string of `n` zeros.\n*\n* @private\n* @param {number} n - number of zeros\n* @returns {string} string of zeros\n*/\nfunction zeros( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += '0';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with zeros to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction zeroPad( str, width, right ) {\n\tvar negative = false;\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tif ( startsWithMinus( str ) ) {\n\t\tnegative = true;\n\t\tstr = str.substr( 1 );\n\t}\n\tstr = ( right ) ?\n\t\tstr + zeros( pad ) :\n\t\tzeros( pad ) + str;\n\tif ( negative ) {\n\t\tstr = '-' + str;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default zeroPad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 isNumber from './is_number.js';\nimport zeroPad from './zero_pad.js';\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as an integer.\n*\n* @private\n* @param {Object} token - token object\n* @throws {Error} must provide a valid integer\n* @returns {string} formatted token argument\n*/\nfunction formatInteger( token ) {\n\tvar base;\n\tvar out;\n\tvar i;\n\n\tswitch ( token.specifier ) {\n\tcase 'b':\n\t\t// Case: %b (binary)\n\t\tbase = 2;\n\t\tbreak;\n\tcase 'o':\n\t\t// Case: %o (octal)\n\t\tbase = 8;\n\t\tbreak;\n\tcase 'x':\n\tcase 'X':\n\t\t// Case: %x, %X (hexadecimal)\n\t\tbase = 16;\n\t\tbreak;\n\tcase 'd':\n\tcase 'i':\n\tcase 'u':\n\tdefault:\n\t\t// Case: %d, %i, %u (decimal)\n\t\tbase = 10;\n\t\tbreak;\n\t}\n\tout = token.arg;\n\ti = parseInt( out, 10 );\n\tif ( !isFinite( i ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\tif ( !isNumber( out ) ) {\n\t\t\tthrow new Error( 'invalid integer. Value: ' + out );\n\t\t}\n\t\ti = 0;\n\t}\n\tif ( i < 0 && ( token.specifier === 'u' || base !== 10 ) ) {\n\t\ti = 0xffffffff + i + 1;\n\t}\n\tif ( i < 0 ) {\n\t\tout = ( -i ).toString( base );\n\t\tif ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tout = '-' + out;\n\t} else {\n\t\tout = i.toString( base );\n\t\tif ( !i && !token.precision ) {\n\t\t\tout = '';\n\t\t} else if ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tif ( token.sign ) {\n\t\t\tout = token.sign + out;\n\t\t}\n\t}\n\tif ( base === 16 ) {\n\t\tif ( token.alternate ) {\n\t\t\tout = '0x' + out;\n\t\t}\n\t\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\t\tuppercase.call( out ) :\n\t\t\tlowercase.call( out );\n\t}\n\tif ( base === 8 ) {\n\t\tif ( token.alternate && out.charAt( 0 ) !== '0' ) {\n\t\t\tout = '0' + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 isNumber from './is_number.js';\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\nvar replace = String.prototype.replace;\n\n\n// VARIABLES //\n\nvar RE_EXP_POS_DIGITS = /e\\+(\\d)$/;\nvar RE_EXP_NEG_DIGITS = /e-(\\d)$/;\nvar RE_ONLY_DIGITS = /^(\\d+)$/;\nvar RE_DIGITS_BEFORE_EXP = /^(\\d+)e/;\nvar RE_TRAILING_PERIOD_ZERO = /\\.0$/;\nvar RE_PERIOD_ZERO_EXP = /\\.0*e/;\nvar RE_ZERO_BEFORE_EXP = /(\\..*[^0])0*e/;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as a floating-point number.\n*\n* @private\n* @param {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( token ) {\n\tvar digits;\n\tvar out;\n\tvar f = parseFloat( token.arg );\n\tif ( !isFinite( f ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\tif ( !isNumber( token.arg ) ) {\n\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t}\n\t\t// Case: NaN, Infinity, or -Infinity\n\t\tf = token.arg;\n\t}\n\tswitch ( token.specifier ) {\n\tcase 'e':\n\tcase 'E':\n\t\tout = f.toExponential( token.precision );\n\t\tbreak;\n\tcase 'f':\n\tcase 'F':\n\t\tout = f.toFixed( token.precision );\n\t\tbreak;\n\tcase 'g':\n\tcase 'G':\n\t\tif ( abs( f ) < 0.0001 ) {\n\t\t\tdigits = token.precision;\n\t\t\tif ( digits > 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\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// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default floor;\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// MODULES //\n\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* import MAX_TYPED_ARRAY_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nexport default MAX_TYPED_ARRAY_LENGTH;\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// MODULES //\n\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isCollection;\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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\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// MAIN //\n\n/**\n* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\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// MAIN //\n\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\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// MAIN //\n\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\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* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\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// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\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// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\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// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\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// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\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// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* import isNumber from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* import FLOAT64_PINF from '@stdlib/constants-float64-pinf';\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default FLOAT64_PINF;\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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* import FLOAT64_NINF from '@stdlib/constants-float64-ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nexport default FLOAT64_NINF;\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// MODULES //\n\nimport PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\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// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\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// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\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// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\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// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\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// MODULES //\n\nimport { isObject as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\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// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* import isInteger from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* import { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* import { isObject as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* import isNonNegativeInteger from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\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* Maximum length of a generic array.\n*\n* @module @stdlib/constants-array-max-array-length\n*\n* @example\n* import MAX_ARRAY_LENGTH from '@stdlib/constants-array-max-array-length';\n* // returns 4294967295\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a generic array.\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default MAX_ARRAY_LENGTH;\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// MODULES //\n\nimport isArrayLike from '@stdlib/assert-is-array-like';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array-like object passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array-like object function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arraylikefcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arraylikefcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array-like object passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array-like object for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArrayLike( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arraylikefcn;\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// MODULES //\n\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is array-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is array-like\n*\n* @example\n* var bool = isArrayLike( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLike( {'length':10} );\n* // returns true\n*/\nfunction isArrayLike( value ) {\n\treturn (\n\t\tvalue !== void 0 &&\n\t\tvalue !== null &&\n\t\ttypeof value !== 'function' &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArrayLike;\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* Test if a value is an array-like object containing only nonnegative integers.\n*\n* @module @stdlib/assert-is-nonnegative-integer-array\n*\n* @example\n* import isNonNegativeIntegerArray from '@stdlib/assert-is-nonnegative-integer-array';\n*\n* var bool = isNonNegativeIntegerArray( [ 3.0, new Number(3.0) ] );\n* // returns true\n*\n* bool = isNonNegativeIntegerArray( [ 3.0, '3.0' ] );\n* // returns false\n*\n* @example\n* import { primitives as isNonNegativeIntegerArray } from '@stdlib/assert-is-nonnegative-integer-array';\n*\n* var bool = isNonNegativeIntegerArray( [ 1.0, 0.0, 10.0 ] );\n* // returns true\n*\n* bool = isNonNegativeIntegerArray( [ 3.0, new Number(1.0) ] );\n* // returns false\n*\n* @example\n* import { objects as isNonNegativeIntegerArray } from '@stdlib/assert-is-nonnegative-integer-array';\n*\n* var bool = isNonNegativeIntegerArray( [ new Number(3.0), new Number(1.0) ] );\n* // returns true\n*\n* bool = isNonNegativeIntegerArray( [ 1.0, 0.0, 10.0 ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport isNonNegativeInteger from '@stdlib/assert-is-nonnegative-integer';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-like-function';\n\n\n// VARIABLES //\n\nvar isPrimitiveArray = arrayfun( isNonNegativeInteger.isPrimitive );\nvar isObjectArray = arrayfun( isNonNegativeInteger.isObject );\n\n\n// MAIN //\n\nvar isNonNegativeIntegerArray = arrayfun( isNonNegativeInteger );\nsetReadOnly( isNonNegativeIntegerArray, 'primitives', isPrimitiveArray );\nsetReadOnly( isNonNegativeIntegerArray, 'objects', isObjectArray );\n\n\n// EXPORTS //\n\nexport default isNonNegativeIntegerArray;\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* Test if a value is an array-like object containing only integers.\n*\n* @module @stdlib/assert-is-integer-array\n*\n* @example\n* import isIntegerArray from '@stdlib/assert-is-integer-array';\n*\n* var bool = isIntegerArray( [ -3.0, new Number(0.0), 2.0 ] );\n* // returns true\n*\n* bool = isIntegerArray( [ -3.0, '3.0' ] );\n* // returns false\n*\n* @example\n* import { primitives as isIntegerArray } from '@stdlib/assert-is-integer-array';\n*\n* var bool = isIntegerArray( [ -1.0, 10.0 ] );\n* // returns true\n*\n* bool = isIntegerArray( [ -1.0, 0.0, 5.0 ] );\n* // returns true\n*\n* bool = isIntegerArray( [ -3.0, new Number(-1.0) ] );\n* // returns false\n*\n* @example\n* import { objects as isIntegerArray } from '@stdlib/assert-is-integer-array';\n*\n* var bool = isIntegerArray( [ new Number(1.0), new Number(3.0) ] );\n* // returns true\n*\n* bool = isIntegerArray( [ -1.0, 0.0, 3.0 ] );\n* // returns false\n*\n* bool = isIntegerArray( [ 3.0, new Number(-1.0) ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport isInteger from '@stdlib/assert-is-integer';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-like-function';\n\n\n// VARIABLES //\n\nvar isPrimitiveArray = arrayfun( isInteger.isPrimitive );\nvar isObjectArray = arrayfun( isInteger.isObject );\n\n\n// MAIN //\n\nvar isIntegerArray = arrayfun( isInteger );\nsetReadOnly( isIntegerArray, 'primitives', isPrimitiveArray );\nsetReadOnly( isIntegerArray, 'objects', isObjectArray );\n\n\n// EXPORTS //\n\nexport default isIntegerArray;\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\nvar RE = /./;\n\n\n// EXPORTS //\n\nexport default RE;\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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Returns a boolean.\n*\n* @name Boolean\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {(boolean|Boolean)} boolean\n*\n* @example\n* var b = Boolean( null );\n* // returns false\n*\n* b = Boolean( [] );\n* // returns true\n*\n* b = Boolean( {} );\n* // returns true\n*\n* @example\n* var b = new Boolean( false );\n* // returns \n*/\nvar Bool = Boolean; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Bool;\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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\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// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Boolean from '@stdlib/boolean-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\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// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\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// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import isBoolean from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isObject as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\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// MAIN //\n\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nexport default obj;\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// MAIN //\n\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nvar obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/string-format';\nimport getThis from './codegen.js';\nimport Self from './self.js';\nimport Win from './window.js';\nimport GlobalThis from './global_this.js';\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @private\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a boolean. Value: `%s`.', codegen ) );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: 2020 revision of ECMAScript standard\n\tif ( GlobalThis ) {\n\t\treturn GlobalThis;\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\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// MAIN //\n\n/**\n* Returns the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\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// MODULES //\n\nimport getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\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// MODULES //\n\nimport reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nexport default f;\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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObjectLike;\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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* import isObjectLike from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* import { isObjectLikeArray as isObjectLike } from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport main from './main.js';\n\n\n// VARIABLES //\n\nvar isObjectLikeArray = arrayfun( main );\n\n\n// MAIN //\n\nsetReadOnly( main, 'isObjectLikeArray', isObjectLikeArray );\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport isArray from '@stdlib/assert-is-array';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arrayfcn;\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// MODULES //\n\nimport isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\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// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\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// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\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// MODULES //\n\nimport typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\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// MODULES //\n\nimport ORDERS from './orders.json';\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray orders.\n*\n* @returns {StringArray} list of ndarray orders\n*\n* @example\n* var list = orders();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\nfunction orders() {\n\treturn ORDERS.slice();\n}\n\n\n// EXPORTS //\n\nexport default orders;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 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* Returns an object mapping supported layouts to integer values for purposes of C inter-operation.\n*\n* ## Notes\n*\n* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `row-major == 101`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of array objects.\n*\n* @returns {Object} object mapping supported layouts to integer values\n*\n* @example\n* var table = enumerated();\n* // returns